Post Go back to editing

Ltc2439-1 in SPI communication data output is high first out or low first out?

Read data is 0XF4,0X53,0XFE, how to parse?



help
[edited by: ljln119 at 3:25 AM (GMT 0) on 14 Jan 2020]
Parents
  • Looking at the timing diagram of Figure 3a, I think there could be something wrong with your communication with the ADC. The first two bits should always be zeros. Can you provide an oscilloscope photo showing CSL, SCK, SDI and SDO? A schematic of your circuit would also be helpful.

    • Read channel 0 data, single-end input, single chip sends 0XB0, right

  • void Write_SPI_Byte(unsigned char SPI_Byte)
    {
    char bit_mask, k;
    SPI_CS(0);//片选
    bit_mask = 0x80; // MSB order first
    for (k = 0; k < 8; k++)
    {
    if(SPI_Byte & bit_mask) // load bit value
    SPI_SIMO(1);
    else
    SPI_SIMO(0);
    SPI_CLK(1); // clock it out
    bit_mask /= 2; // next bit (the "/= 2" provides necessary delay over ">> 1")
    SPI_CLK(0); // clock reset
    }
    SPI_CS(1);
    }

    //--------------------------------------------------

    unsigned char Read_SPI_Byte(void)
    {
    unsigned char i;
    unsigned char SPI_Byte=0;
    //SPI_CS(0);//片选
    for (i = 0x01; i != 0; i <<= 1) //低位在前,逐位读取
    {
    if (SPI_SOMI != 0) //首先读取此时的IO引脚,并设置dat中的对应位
    {
    SPI_Byte |= i;
    }
    SPI_CLK(1); //然后拉高时钟
    SPI_CLK(0); //再拉低时钟,完成一个位的操作
    }
    return SPI_Byte; //最后返回读到的字节数据
    }

    void Read_LTC2439_Data(void)
    {
    unsigned char Data[3]={0,0,0};//从SPI总线读取的数据,Data[0]是最高位
    unsigned char i,j;

    Write_SPI_Byte(0XB0);
    delay_ms(200);
    SPI_CS(0);//片选
    SPI_Data[0]=Read_SPI_Byte();//接收数据,Data[0]是最高位
    SPI_Data[1]=Read_SPI_Byte();//接收数据,
    SPI_Data[2]=Read_SPI_Byte();//接收数据
    SPI_CS(1);//片选
    delay_ms(200);
    Write_SPI_Byte(0XB1);
    delay_ms(200);
    SPI_CS(0);//片选
    SPI_Data[4]=Read_SPI_Byte();//接收数据,Data[0]是最高位
    SPI_Data[5]=Read_SPI_Byte();//接收数据,
    SPI_Data[6]=Read_SPI_Byte();//接收数据
    SPI_CS(1);//片选
    }

    Is there something wrong with my SPI program? Please give me the guidance. Thank you!

  • I am not a programmer. It appears that your program is correctly telling the ADC what to do but it is not correctly deciphering the data that comes from the ADC. Did my description of how to decode the data from the ADC make sense to you? Can you use that to determine where your program is misinterpreting the ADC data?

    Looking at your schematic, I think I understand why the ADC reading is not correct. You have a large filter on the CH0-CH11 inputs. This filter will not settle in the time allowed. I suggest you put the same filter on the COM pin or reduce the size of the filter.

  • Thank you very much for your reply, the analytic method you provided is very useful!In the schematic diagram, the input terminal of ltc2439-1 is the partial voltage circuit. After deletion, the program of reading data at the same time has been modified.Ask: what is the voltage range of the input terminal of ltc2439-1? At present, 0.522v is input and MCU is read correctly.Input 5.0v, MCU reading value is 30,00,1f, data parsing is 2500, why?My circuit reference voltage is 5V.

  • With COM = 0V, the input voltage range for a single-ended signal is 0V to Vref/2. With a 5V reference that means 0V to 2.5V.

  • Thank you very much!Another question, I set the maximum charging current 2A, and the charging cut-off voltage 2.6v. Why is the charging current 1.7a when the charging voltage is 2.2v? As the voltage rises, the current is gradually decreasing?I understand that the working mode of ltc2439-1 is constant current 2A first, and the current gradually decreases after reaching the voltage of 2.6v until the charging is completed.Why not me?

  • I do not understand your question. What are the charging current and cut-off voltage you are referring to? This sounds more like a switching regulator than an ADC.

    • Sorry, I misremembered! It's the BQ24650 chip.

  • Ltc2439-1 chip, internal shock MCU communicate with other SPI, MCU send channel command after waiting for how long to start reading?

    After MCU sends the read command, how long will it take for ltc2439-1 to be converted and the MCU to read the data?

    See Table4 for specification, conversion time 147ms.

    At present, I send the channel command with a delay of 200ms, then send the read command with a delay of 200ms, then read the data.

    Why is this chip communicating so slowly?The display speed of the touch screen is too slow to refresh.

    It would be nice to have an ltc2439-1 communicator example available!

  • The problem now is that the ltc2439-1 data read time is too slow.

    My reading order is: send channel command -> delay 200ms-> send read command -> delay 200ms-> receive data.

    The data received should now be correct.That's how long it takes to read?It would be even better to have program examples!Thank you very much!

  • As I mentioned previously, this is a relatively old device. There are no code examples available. Newer devices are available with faster conversion times and code examples. The LTC2448 and LTC2449 are 16 channel ADCs that can sample up to 8ksps and both have code examples available.

Reply Children