您好!
我想从 ads1292读取芯片 ID 寄存器0x00、但我没有得到预期的确切值。
============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
void SPI_EVENT_handler (nrf_drv_spi_evt_t const * p_event、
void * p_context)
{
SPI_xfer_DONE = true;
nrf_log_info ("传输已完成");//nrf_log_flush ();
如果(m_rx_buf[0]!= 0)
{
nrf_log_info ("已接收:");
nrf_log_HEXDUMP_info (m_rx_buf、strlen ((const char *) m_rx_buf));
}
}
////// 初始化 SPI ////
spi_config.ss_pin = Arduino _7_PIN;
SPI_CONFIG.Miso_pin = Arduino _12_PIN;
SPI_CONFIG.MOSI_Pin = Arduino_11_PIN;
SPI_CONFIG.SCK_Pin = Arduino_13_PIN;
SPI_CONFIG.BIT_Order = NRF_DRV_SPI_BIT_ORIG_MSB_FIRST;
SPI_CONFIG.MODE = NRF_DRV_SPI_MODE_0;
spi_config.frequency = NRF_DRV_SPI_FREQ_4M;
SPI_CONFIG.ORC = 0x00;
APP_ERROR_CHECK (nrf_drv_spi_init (&SPI、&spi_config、SPI_EVENT_handler、NULL));
nrf_log_info ("SPI 示例已启动。");nrf_log_flush ();
////// 通过拉低硬件引脚 ////重置电路板
NRF_GPIO_PIN_WRITE (ADS1292_PWDN_PIN、高电平);
延迟(100);
NRF_GPIO_PIN_WRITE (ADS1292_PWDN_PIN、低电平);
延迟(100);
NRF_GPIO_PIN_WRITE (ADS1292_PWDN_PIN、高电平);
延迟(100);
////////// 停止继续数据接收模式//////////
spi_xfer_done = false;memset (m_rx_buf、0、sizeof (m_rx_buf));
spiDataTx[0]= 0x11;
app_error_check (nrf_drv_spi_transfer (&SPI、spiDataTx、1、m_rx_buf、sizeof (m_rx_buf)));
while (!SPI_xfer_done){__WFE ();}
nrf_log_flush ();
//////////// 读取芯片 ID 寄存器(0x00)//////////////////
字符 tempData[3];
tempData[0]= 0x20;
tempData[1]=0x00;
tempData[2]=0x00;
spi_xfer_done = false;memset (m_rx_buf、0、sizeof (m_rx_buf));
app_error_check (nrf_drv_spi_transfer (&SPI、tempData、3、m_rx_buf、sizeof (m_rx_buf)));
while (!SPI_xfer_done){__WFE ();}
nrf_log_flush ();
============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
正在等待更好的解决方案。
非常感谢您的参与。