请求各位大佬不吝指导,确实不知道该怎么办了……
ADC读写寄存器均正常,但是数据转换后,得到的数据为 0x2200 0000 0000 0000 0000
用示波器看DRDY输出波形,一直为高电平,应该是说明没有开始转换。
配置数据位:M0高电平,M1高电平,M2低电平
原理图:
基本和官方给出的设计文档一致,参考电压采用内部电压,寄存器配置如下
A_SYS_CFG:0x68
D_SYS_CFG:0x3e
无源晶振:16.384Mhz分频,8 8 4096
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
请求各位大佬不吝指导,确实不知道该怎么办了……
ADC读写寄存器均正常,但是数据转换后,得到的数据为 0x2200 0000 0000 0000 0000
用示波器看DRDY输出波形,一直为高电平,应该是说明没有开始转换。
配置数据位:M0高电平,M1高电平,M2低电平
原理图:
基本和官方给出的设计文档一致,参考电压采用内部电压,寄存器配置如下
A_SYS_CFG:0x68
D_SYS_CFG:0x3e
无源晶振:16.384Mhz分频,8 8 4096
您好,非常感谢您的回答,我把启动代码贴在下面。初始化流程是按照流程图和参考例程过来的。
void adcStartup(void) { HAL_Delay(100); HAL_GPIO_WritePin(GPIOC, GPIO_PIN_8, GPIO_PIN_SET); restoreRegisterDefaults(); // Always send a NULL command before sending a new command HAL_Delay(5); sendCommand(OPCODE_NULL); uint16_t response = sendCommand(OPCODE_NULL); if (response != 0xFF02) { assert(0); } printf("response: %x\n", response); unlockRegisters(); uint8_t regVal = D_SYS_CFG_DEFAULT; #ifdef SET_FIXED regVal |= D_SYS_CFG_FIXED_MASK; #endif #ifdef SET_CRC_EN regVal |= D_SYS_CFG_CRC_EN_MASK; // Set CRC_EN bit #endif #ifdef SET_CRC_MODE regVal |= D_SYS_CFG_CRC_MODE_MASK; // Set CRC_MODE bit #endif // Write to D_SYS_CFG_ADDRESS writeSingleRegister(D_SYS_CFG_ADDRESS, regVal); // Write to A_SYS_CFG_ADDRESS writeSingleRegister(A_SYS_CFG_ADDRESS, 0x68); // Config data rate writeSingleRegister(CLK1_ADDRESS, CLK1_CLK_DIV_8); writeSingleRegister(CLK2_ADDRESS, CLK2_ICLK_DIV_8 | CLK2_OSR_400); // Enable all ADC channels writeSingleRegister(ADC_ENA_ADDRESS, ADC_ENA_ENA_ALL_CH_PWUP); // 0x0F /* (REQUIRED) Always send a NULL command first to establish SPI communication */ sendCommand(OPCODE_WAKEUP); // 0x0033 lockRegisters(); // Ignore the first 3-4 conversion results to allow for the // output buffers to fill-up and the SINC3 filter to settle uint8_t ignore_counter = 4; AdcDataStruct dummy_data; while (ignore_counter > 0) { readData(&dummy_data); ignore_counter--; } }