Hello,
I am trying to code nRF52840- DK with MAX30003 ECG Board Using SPI. I have referred Arduino Uno Code for MAX30003 ECG.
I need some help for Driver Development if anybody worked on this please share any info.
Thanks and Regards,
Rohit
Hello,
I am trying to code nRF52840- DK with MAX30003 ECG Board Using SPI. I have referred Arduino Uno Code for MAX30003 ECG.
I need some help for Driver Development if anybody worked on this please share any info.
Thanks and Regards,
Rohit
Hey Rohit,
Either you answer the questions asked by Nordic staff or community members or you wont get any help from us. We can only help you help yourself. If you do not want our help please refrain from using our forum. It will not help you to keep posting the same question in new threads without engaging in any conversation in your ongoing thread:
See the public duplicates:
https://devzone.nordicsemi.com/f/nordic-q-a/39021/max30003-ecg-with-nrf52840
https://devzone.nordicsemi.com/f/nordic-q-a/39063/spi-communication-with-max30003-ecg-reg_read_write
I have got a few tips for your current project:
Here's an abstract architecture of your FW with regards to the MAX30003:
Good luck,
Håkon H.
Hey Rohit,
Either you answer the questions asked by Nordic staff or community members or you wont get any help from us. We can only help you help yourself. If you do not want our help please refrain from using our forum. It will not help you to keep posting the same question in new threads without engaging in any conversation in your ongoing thread:
See the public duplicates:
https://devzone.nordicsemi.com/f/nordic-q-a/39021/max30003-ecg-with-nrf52840
https://devzone.nordicsemi.com/f/nordic-q-a/39063/spi-communication-with-max30003-ecg-reg_read_write
I have got a few tips for your current project:
Here's an abstract architecture of your FW with regards to the MAX30003:
Good luck,
Håkon H.
Hello sir sorry for that,
may i know nrf SPIM driver means "spi_master_using_nrf_spi_mngr" example?
I suggest you start with the nrfx SPI Master Example first, then if you want you can use the SPI Transaction Manager Example. The transaction manager is just another layer of abstraction useful when dealing with multiple slaves with different SPI configurations on the same bus. If you're only interfacing with this one sensor then there's no need for the SPI transaction manager.
Se also the SPI master docs and SPIM API references.
Hi Haakonsh,
Thank you for your suggestion, I am using nRFX_spim Example now.
I have done REG read function for reading MAX30003ECG Register value, In function, I have to read SPI transmit and SPI Receive.
I want to store Tx & Rx data in a CHAR_ARRAY but it is not storing in the SPI_temp_32b[i]. Please check it in below code
void MAX30003_Reg_Read(uint8_t Reg_address)
{
nrf_gpio_pin_clear(NRFX_SPIM_SS_PIN);
SPI_TX_Buff[1] = (Reg_address<<1 ) | RREG;
// Please clarify below function correct or not //
nrfx_spim_xfer_desc_t xfer_desc4 = NRFX_SPIM_XFER_TRX(SPI_TX_Buff[1], sizeof(SPI_TX_Buff[1]), SPI_RX_Buff, sizeof(SPI_TX_Buff[1]));
for ( i = 0; i < 3; i++)
{
SPI_temp_32b[i]= NRFX_SPIM_XFER_TRX(A, sizeof(A), SPI_RX_Buff, sizeof(A));
}
nrf_gpio_pin_set(NRFX_SPIM_SS_PIN);
}
Regards,
Rohit
I have to read SPI transmit and SPI Receive.
That makes no sense!
Transmit is what you send - so why do you need to read it??
Use the 'Insert Code' feature to get properly formatted source code in your post:
From MAX30003 spec:
The device is programmed and accessed by a 32 cycle SPI instruction framed by a CSB low interval. The content of the SPI operation consists of a one byte command word (comprised of a seven bit address and a Read/Write mode indicator, i.e., A[6:0] + R/W) followed by a three-byte data word.
Read mode operations will access the requested data on the 8th SCLK rising edge, and present the MSB of the requested data on the following SCLK falling edge, allowing the µC to sample the data MSB on the 9th SCLK rising edge. Configuration, Status, and FIFO data are all available via normal mode read back sequences. If more than 32 SCLK rising edges are provided in a normal read sequence then the excess edges will be ignored and the device will read back zeros.
uint8_t SPI_TX_Buff[4]; // 32 bit transfers void MAX30003_Reg_Read(uint8_t Reg_address) { nrfx_err_t err_code = NRF_SUCSESS; // nrf_gpio_pin_clear(NRFX_SPIM_SS_PIN); The driver should handle the SS pin automatically. //Prepare the tx buffer memset(SPI_TX_Buff[0], 0x00, sizeof(SPI_TX_Buff)); // Erases the buffer memset(SPI_RX_Buff[0], 0x00, sizeof(SPI_TX_Buff)); // Erases the buffer SPI_TX_Buff[0] = (Reg_address<<1 ) | RREG; // should be SPI_TXBuff[0], I assume RREG = 0x1; //Create the transfer descriptor nrfx_spim_xfer_desc_t xfer_desc4 = NRFX_SPIM_XFER_TRX(SPI_TX_Buff[0], sizeof(SPI_TX_Buff), SPI_RX_Buff[0], sizeof(SPI_TX_Buff)); //Initiate the transfer err_code = nrfx_spim_xfer(&Your_SPIM_Instance, &xfer_desc4, 0); // nrf_gpio_pin_set(NRFX_SPIM_SS_PIN); The driver should handle the SS pin automatically. } // When the SPIM event handler is called with the NRFX_SPIM_EVENT_DONE event, the SPI_RX_Buff[1] to 3 will contain the received data.
You should also scope the SPI communication with a digital logical analyzer. I suggest a Saleae Logic 8 or similar devices.