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.

[参考译文] ADS1292:读取/写入 ADS1292

Guru**** 2387830 points
Other Parts Discussed in Thread: ADS1292
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/data-converters-group/data-converters/f/data-converters-forum/1121713/ads1292-read-write-ads1292

器件型号:ADS1292

您好!  

我正在尝试将 ADS1292与 PSoC 连接、但我无法读取寄存器值(即使 ID 寄存器返回0x00)。

请注意、ADS 在默认配置下工作。 我们在多个 ADS1292芯片上面临这一问题。

以下是我在调试时遵循的步骤:

1.数据表中提到的上电顺序。  

2.如 TI 论坛中其他几个问题中所述、增加了延迟。

3.已检查 VCAP1、VCAP2和 Vref 的值。

4.探测 MISO/CS/CSLK/DRDY 线路并在示波器上进行检查。

这是我使用的代码:

初始化

//Defines for Commands.
#define WakeUpCmd           0x02
#define StandByCmd          0x04
#define ResetCmd            0x06
#define StartCmd            0x08
#define StopCmd             0x0A
#define SDATACCmd           0x11
#define RDATACmd            0x12
#define ReadRegCmd          0x20
#define WriteRegCmd         0x40
// Defines for Register Addresses.
#define ID_Addr             0x00
#define CONFIG1_Addr        0x01
#define CONFIG2_Addr        0x02
#define CH1SET_Addr         0x04
#define CH2SET_Addr         0x05
#define RLDSENS_Addr        0x06
#define RESP1               0x09
#define RESP2               0x0A

ADS 配置的功能

void my_ads_config(void)
{
    uint8 temp;
    
    /*Power UP Sequence*/
    Pin_MISO_Write(0);
    Pin_MOSI_Write(1);
    Pin_SCLK_Write(0);
    Pin_DRDY_Write(1);
    Pin_SS_Write(1);
    Pin_PWDN_Write(0);
    Pin_Start_Write(0);
    
    /*Wait for Tpor=1s*/
    CyDelay(1000);
    
    /*Set CLK=1*/
    Pin_SCLK_Write(1);
    
    /*Wait for Tpor=1s*/
    CyDelay(1000);
    
    /*RESET PULSE*/
    Pin_PWDN_Write(1);
    CyDelay(1000);
    Pin_PWDN_Write(0);
    CyDelay(1000);
    Pin_PWDN_Write(1);
    CyDelay(100);
    
    /*Reset communication*/
    Pin_SS_Write(0);
    CyDelay(1000);
    Pin_SS_Write(1);
    CyDelay(500);
    
    /* stop read data continous mode */
    SendCommand(SDATACCmd);
    CyDelay(10);
    
    /*Read ID register*/
    temp = ReadRegister(0x00);
    
    /* using internal buffer*/
    WriteRegister(CONFIG2_Addr, 0xA0);
    CyDelayUs(10);
    temp = ReadRegister(0x02);
 
    SendCommand(StartCmd);
}

2.读取寄存器的函数

 

uint8 ReadRegister (uint8_t ui8RegAddress)
{
    uint8_t tx_buf [3];
    uint8_t rx_buf[3];
    const uint8_t PACKET_SIZE = 3;
    Pin_SS_Write(0);
     
    /* Send write register command appended with the register address. */
    tx_buf[0] = ReadRegCmd | ui8RegAddress;
    CyDelayUs(5);
    tx_buf[1] = 0;
    CyDelayUs(5);
    tx_buf[2] =  0;
    CyDelayUs(5);
    
    /* start transfer */
    SPIM_ads_SpiUartPutArray(tx_buf, PACKET_SIZE);
    
    /* wait for the end of the transfer */
    while(PACKET_SIZE != SPIM_ads_SpiUartGetRxBufferSize());
    
    Pin_SS_Write(1);
    
    /* read RX buffer */
    rx_buf[0] = (uint8) SPIM_ads_SpiUartReadRxData();
    rx_buf[1] = (uint8) SPIM_ads_SpiUartReadRxData();
    rx_buf[2] = (uint8) SPIM_ads_SpiUartReadRxData();
    
    
    /* clear dummy bytes from RX buffer */
    SPIM_ads_SpiUartClearRxBuffer();
    
    /* return the register content */
    return(rx_buf[2]);
}

3.写入寄存器的函数

void WriteRegister (uint8_t ui8RegAddress, uint8_t ui8RegData)
{
    uint8_t tx_buf [3];
    const uint8_t PACKET_SIZE = 3;
  
    /* Send write register command appended with the register address. */
    tx_buf[0] = WriteRegCmd | ui8RegAddress;
    CyDelayUs(5);
    tx_buf[1] = 0;
    CyDelayUs(5);
    tx_buf[2] = ui8RegData;
    CyDelayUs(5);
    
    /* start transfer */
    SPIM_ads_SpiUartPutArray(tx_buf, PACKET_SIZE);
    
    /* wait for the end of the transfer */
    while(PACKET_SIZE != SPIM_ads_SpiUartGetRxBufferSize());
    
    /* clear dummy bytes from RX buffer */
    SPIM_ads_SpiUartClearRxBuffer();
}

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    我是否可以要求进一步澄清?

    1.您是否碰巧拥有/使用 ADS1292评估套件/板(EVM)? 或者、您是否使用自己的定制板并使用 PSoC 与此类板通信? 使用了什么 CLK 频率 fCLK?

    2."(即使 ID 寄存器返回0x00)。"   是的、如果您使用的是 ADS1292 (R)、则 ADS1292器件会意外出现这种情况。

    3.请说明您在说"请注意 ADS 在默认配置下运行。 我们正面临多个 ADS1292芯片的这一问题。"?

    那么、这是否意味着您能够读取 ECG 信号或内部测试信号?

    "多个 ADS1292芯片" 您是否以菊花链方式连接多个 ADS1292芯片? 或者、您是否会在不同的单独 ADS1292芯片上遇到相同的问题?

    很高兴您执行了一些调试步骤。 结果如何? 它们是否都与数据表匹配/一致?

    例如、您能否提供的一些示波器屏幕截图

    1.上电顺序参见 ADS1292数据表第65页。 您可以通过探测 AVDD、DVDD 来表示电源。 您的 AVDD、DVDD 和 VREF 可能是什么?

    2. 与上述步骤1上电顺序类似,但请确保执行
    等待至少2^12 tMOD (请注意、对于 CLK_DIV = 0 (即 fCLK = 512kHz)、对于电源和芯片电源上的/RESET、tMOD = 4 tCLK  
    然后、将/reset 拉至低电平至少1 tMOD。
    然后、 在/reset 拉高后等待至少18 tCLK、您可以继续执行下一步骤3读取 ID。

    3.读取 ID 时的时序(请参阅数据表第50页的图54)、即 寄存器地址00h

    此外,在“ADS Configuration”(ADS 配置)功能/*Power Up Sequence*/部分-

    我假设这些代码在主 PSoC 上运行、对吧?

    一些意见-
    1.我看不到正确的加电序列反映了上面建议的序列和/或时序。
    2.我假设 MISO 会导致 ADS1292的 DOUT、MOSI 会导致 ADS1292的 DIN、对吧?   写入 MOSI (DIN)可能是可以的、因为它是一个数字输入。 但是、您可能不想写入 MISO (DOUT)、因为它是数字输出、可能会损坏引脚... 话虽如此、您是否需要将数字 I/O 引脚定义/设置/配置为输入或输出?
    3、对于 PIN_SCLK_Write (0); 请问如何生成 SCLK? 这是执行/写入 SCLK 引脚的正确方法吗? 您的 SCLK 频率可能是多少? 它是否符合数据表?
    引 脚_DRDY_Write (1)也是如此; DRDY 是 ADS1292的数字输出引脚; 您可能不想写入 DRDY、因为它是数字输出、可能会损坏引脚。
    5.或者,您的/*Power Up Sequence*/是否正在进行 I/O 引脚定义? 有点令人困惑、需要澄清。
    6. SS 引脚的用途是什么?   PIN_PWDN_Write (0);和 PIN_Start_Write (0); 执行 I/O 定义或写入值?

    因此、让我们确保第35行之前的代码正常工作、尤其是上电和复位序列正常工作、然后再继续。

    如果您需要设置与我的通话、请随时通知我。

    谢谢。