如图是ADS131M04的原理图,使用示波器测量有源晶振波形:
使用示波器测量sclk和cs
clk和mosi
clk和miso:
本来希望发送spi 发送 0x00,0x00,0x00 获取ads131m04的ID验证芯片是否工作;
请问我这个方法正确吗,是不是我这个芯片坏了?
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.
你好我clkin 改用stm32 占空比 50% 的PWM波(如下图) ,之前8.192MHZ晶振可能示波器带宽不够( 示波器100MHZ 1GSa/S )
读取ID代码改为:(读取RE命令 0XA000 , ID地址0x00)
uint8_t rx[19];
void TM7707_Initialize(void)
{
// Initialize GPIO for TM7707 device.
TM7707_InitializeGPIO();
// Initialize SPI controler.
TM7707_InitializeSPI2();
// Synchronize device clock.
//TM7707_SynchronizeDeviceClock();
// Configure the clock registers
TM7707_CS_ENABLE(); // CS = 0;
rx[0] = SPI_TransferByte((0xA000 | (((uint16_t)0X00) << 7))>>8);
rx[1] = SPI_TransferByte((0xA000 | (((uint16_t)0X00) << 7))&0XFF);
rx[2] = SPI_TransferByte(0x00);
TM7707_CS_DISABLE(); // CS = 0;
}
示波器读取:
CLK AND MOSI
CLK AND MISO
ID仍然不读取不成功;
PS: (DRDY 频率976.59HZ)
您使能CRC了吗?CRC默认是禁用的,如果没有使能只发RREG 命令0XA000就可以了,看第一个示波器图片中发了3个字节,0XA000是2个字节
ADS131M04提供了ADS131M0x Example C Code (Rev. B),可以从ADS131M04产品首页下载,希望对您有帮助:
https://www.ti.com.cn/cn/lit/zip/sbac254
我换了一个单片机测试,不知道为什么我的SPI MOSI总线输出的电压没有到3.3V同时,DRDY也不是连续输4k的脉冲;
、
断开单片机与ADS131M04;
PS 怀疑晶振有异常:
请问默认DRDY是不是总是8.192mhz下4K输出的?我这个中间断开一段时间;连续的时候是4K的
上面为什么发3个字节呢,主要芯片默认是24位的,例程也是发3*8的
uint8_t buildSPIarray(const uint16_t opcodeArray[], uint8_t numberOpcodes, uint8_t byteArray[])
{
/*
* Frame size = opcode word(s) + optional CRC word
* Number of bytes per word = 2, 3, or 4
* Total bytes = bytes per word * number of words
*/
numberWords = numberOpcodes + (SPI_CRC_ENABLED ? 1 : 0);//1+0 =1;
bytesPerWord = getWordByteLength(); //24 bit; -->3
numberOfBytes = numberWords * bytesPerWord;
int i;
for (i = 0; i < numberOpcodes; i++)
{
// NOTE: Be careful not to accidentally overflow the array here.
// The array and opcodes are defined in the calling function, so
// we are trusting that no mistakes were made in the calling function!
byteArray[(i*bytesPerWord) + 0] = upperByte(opcodeArray[i]);
byteArray[(i*bytesPerWord) + 1] = lowerByte(opcodeArray[i]);
}
#ifdef ENABLE_CRC_IN
// Calculate CRC and put it into TX array
uint16_t crcWord = calculateCRC(&byteArray[0], numberOfBytes, 0xFFFF);
byteArray[(i*bytesPerWord) + 0] = upperByte(crcWord);
byteArray[(i*bytesPerWord) + 1] = lowerByte(crcWord);
#endif
return numberOfBytes;
}
getWordByteLength 得到的是3;numberOfBytes=1*3=3
uint8_t numberOfBytes = buildSPIarray(&opcode, 1, dataTx);
所以是一次发3个字节;