硬件描述
CPU使用STM32F429,分别通过SPI2和SPI3挂载了两片AD7616,记为MAIN_ADC和BKUP_ADC,采集32路模拟信号。
电路板经过了一年左右的内外部测试,MAIN_ADC一直使用正常,但近期两批电路板上,MAIN_ADC工作不正常。
问题描述
近期开了两批电路板,嘉立创焊好了芯片。
MAIN_ADC时而正常、时而不正常;不正常的情况占99%,具体表现为16个通道信号只有两路能正常采集和输出。
BKUP_ADC一切正常。
程序中,使用RT-Thread的SPI接口,做了自定义修改,支持DMA,通过程序向AD7616写0x20~0x3F寄存器、0x02寄存器,控制工作模式和序列堆栈寄存器。
MAIN_ADC输出log日志
[5909] D/ad7616_device: Read: AD7616 register (0x20) = 0x0008
[5909] D/ad7616_device: Read: AD7616 register (0x21) = 0x0008
[5909] D/ad7616_device: Read: AD7616 register (0x22) = 0x0008
[5909] D/ad7616_device: Read: AD7616 register (0x23) = 0x0008
[5909] D/ad7616_device: Read: AD7616 register (0x24) = 0x0008
[5910] D/ad7616_device: Read: AD7616 register (0x25) = 0x0008
[5910] D/ad7616_device: Read: AD7616 register (0x26) = 0x0008
[5910] D/ad7616_device: Read: AD7616 register (0x27) = 0x0008
[5912] D/ad7616_device: ADC7616 Enable Sequence stack and burst mode.
[5912] D/ad7616_device: Read: AD7616 register (0x02) = 0x0008
[5912] D/ad7616_device: Read: AD7616 register (0x03) = 0x0008
[5912] D/ad7616_device: Read: AD7616 register (0x04) = 0x0008
[5912] D/ad7616_device: Read: AD7616 register (0x05) = 0x0008
[5912] D/ad7616_device: Read: AD7616 register (0x06) = 0x0008
[5912] D/ad7616_device: Read: AD7616 register (0x07) = 0x0008
AD7616的[0x02]寄存器被配置成了0x0008,表示没有启用Sequence模式、没有启用Burst模式。因此,MAIN_ADC只采集了默认的A0和B0通道,能解释硬件上只有两路信号输出。
BKUP_ADC输出log日志:
[5909] D/ad7616_device: Read: AD7616 register (0x20) = 0x0000
[5909] D/ad7616_device: Read: AD7616 register (0x21) = 0x0011
[5909] D/ad7616_device: Read: AD7616 register (0x22) = 0x0022
[5909] D/ad7616_device: Read: AD7616 register (0x23) = 0x0033
[5909] D/ad7616_device: Read: AD7616 register (0x24) = 0x0044
[5910] D/ad7616_device: Read: AD7616 register (0x25) = 0x0055
[5910] D/ad7616_device: Read: AD7616 register (0x26) = 0x0066
[5910] D/ad7616_device: Read: AD7616 register (0x27) = 0x0177
[5912] D/ad7616_device: ADC7616 Enable Sequence stack and burst mode.
[5912] D/ad7616_device: Read: AD7616 register (0x02) = 0x0078
[5912] D/ad7616_device: Read: AD7616 register (0x03) = 0x0000
[5913] D/ad7616_device: Read: AD7616 register (0x04) = 0x00aa
[5913] D/ad7616_device: Read: AD7616 register (0x05) = 0x00aa
[5913] D/ad7616_device: Read: AD7616 register (0x06) = 0x00aa
[5913] D/ad7616_device: Read: AD7616 register (0x07) = 0x00aa
AD7616的[0x02]寄存器被配置成0x0078,表示启用Seqeunce模式,启用Burst模式,且按照[0x20]~[0x27]寄存器的配置,使用一个Convst信号,就可以完成A0/B0 ~ A7/B7合计16个通道的数据。
配置正常,数据采集正常。
疑惑
在程序中,将MAIN_ADC修改成BKUP_ADC,只需要改一个字符串即可,可以排除程序不同的原因。
虽然没有用逻辑分析仪,但是,可以确定A0/B0通道采集的数据波形正确,表明MAIN_ADC的SPI在传输采样结果时一切正常。
为什么MAIN_ADC配置过程数据错误,采集过程数据正确呢?
有什么好的排查手段吗?我计划让学生先把MAIN_ADC吹下来,再焊上测试。
虚心求教,希望能得到大家的帮助,谢谢!
更多回帖