Hi,
I have merged nrfx_spi and ble_app_uart examples. I am working with SDK15.3 on a nRF52832 based ISP1507. I seem to be able to transmit the data stored in the tx buffer successfully. However, I still have things to modify and adapt. As far as I understand, the length of transmission and reception have to be constant and known in advanced. However I am having a problem with this. In my application, there will be different cases in terms of number of bytes to be transmitted to and received from a sensor.
Some of the cases I will encounter are;
1) Transmit 1 byte and receive nothing
2) Transmit 30 bytes and receive nothing
3) Transmit 2 bytes and receive 30 bytes
4) Transmit nothing and receive 20 bytes at specific times.
In the example the nrfx_spim_xfer_desc_t structure is configured as;
nrfx_spim_xfer_desc_t xfer_desc = NRFX_SPIM_XFER_TRX(m_tx_buf, m_length, m_rx_buf, m_length);
This one uses NRFX_SPIM_XFER_TRX which denotes both TX and RX, where m_length is constant. Considering my cases, I think I have to define 4 different nrfx_spim_xfer_desc_t structures using NRFX_SPIM_XFER_TRX , NRFX_SPIM_XFER_TX and NRFX_SPIM_XFER_RX functions accordingly by providing them with separate constant length variables with the corresponding values.
Is this a correct application? Are there any better solutions to this, probably a more flexible one in terms length?
Thanks,
Den