Hello,
We are currently using SDK v17.0.2 with NRF52840, driving a display with SPIM3. We are able to successfully communicate with our display and command it to render various things. Because it's a display, we have MOSI and MISO tied together as the same pin (the display does not utilize a MISO line).
I am currently attempting to read back the temperature from the display, but not getting a sensible read. With MOSI and MISO tied together, is there special pin driving logic that needs to be performed?
Here is my code:
// Set up logic
#define EINK_XFER_BUF_LEN ( 2048 ) // bytes
#define EINK_COMMAND_LEN ( 1 ) // bytes
#define EINK_RECEIVE_BUF_LEN ( 1 ) // bytes
#define TEST_DELAY_US ( 150 ) // In microseconds
static uint8_t m_tx_buf[EINK_XFER_BUF_LEN] __attribute__( (section( ".errata198_workaround" ) ) ) = { 0 };
static uint8_t m_rx_buf[EINK_RECEIVE_BUF_LEN] __attribute__( (section( ".errata198_workaround" ) ) ) = { 0 };
nrfx_spim_xfer_desc_t xfer_receive_desc = NRFX_SPIM_XFER_TRX( m_tx_buf, 1, m_rx_buf, 1 );
// Send temperature read command
m_tx_buf[0] = TSC;
einkCtx->commandSent = m_tx_buf[0];
einkCtx->isCommand = true;
einkCtx->spiXferDone = false;
// Signal to the EPD that this is a command
memset(m_rx_buf, 0, EINK_RECEIVE_BUF_LEN);
einkCtx->retCode = nrfx_spim_xfer_dcx( &spim_eink, &xfer_receive_desc, 0, 1 );
nrf_delay_us( TEST_DELAY_US );
// Read back logic in callback function
if ( xsferCtx->commandSent == READ_TEMP )
{
// Wait until the Display is no longer busy
while ( !nrf_gpio_pin_read( E_INK_BUSY_PIN ) );
if ( m_rx_buf[0] != 0 )
{
NRF_LOG_INFO(" TSC Received:");
xsferCtx->epd_temperature = m_rx_buf[0];
NRF_LOG_INFO("m_rx_buf[0] == 0x%X ", m_rx_buf[0]);
}
}