This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

OLED display not working fine in nrf52840 preview dk

Hi All,

I am working on a project where i need to use a SPI 128x32 OLED display and a SD card interfaced over SPI to nRF52840 along with BLE. Although, i tried this with nRF51422 and succeeded. Now i am trying to run the same code on nRF52840, and it is not happening. My BLE and SD card are working fine on this, but not the OLED display.

On Logic analyzer, my SD card and OLED Display are working fine on nRF51422, but when i am trying on nRF52840, the logic analyzer shows that there is an extra byte that is sent on MOSI line as compared to that from nRF51422, and my OLED display is showing garbage, probably because of this.

What could be the solution? Help please.

Thank you in advance.

Regards.

Parents
  • void spi_send_recv(uint8_t * const p_tx_data, uint8_t * const p_rx_data, const uint16_t len) { m_transfer_completed = false; // Start transfer. nrf_drv_spi_transfer(&m_spi_master, p_tx_data, len, p_rx_data, len);

    	  // Commented to make this non blocking.
        while (!m_transfer_completed);
    }
    
    
    uint8_t* spi_transfer(uint8_t * message, const uint16_t len)
    {
        memcpy((void*)m_tx_data, (void*)message, len);
        spi_send_recv(m_tx_data, m_rx_data, len);
        return m_rx_data;
    }
    
    #if 0
    void spi_send(uint8_t * message, const uint16_t len)
    {
        memcpy((void*)m_tx_data, (void*)message, len);
        spi_send_recv(m_tx_data, m_rx_data, 0);
    }
    #endif
    

    is there anything else that i am supposed to share? if yes, please let me know

Reply
  • void spi_send_recv(uint8_t * const p_tx_data, uint8_t * const p_rx_data, const uint16_t len) { m_transfer_completed = false; // Start transfer. nrf_drv_spi_transfer(&m_spi_master, p_tx_data, len, p_rx_data, len);

    	  // Commented to make this non blocking.
        while (!m_transfer_completed);
    }
    
    
    uint8_t* spi_transfer(uint8_t * message, const uint16_t len)
    {
        memcpy((void*)m_tx_data, (void*)message, len);
        spi_send_recv(m_tx_data, m_rx_data, len);
        return m_rx_data;
    }
    
    #if 0
    void spi_send(uint8_t * message, const uint16_t len)
    {
        memcpy((void*)m_tx_data, (void*)message, len);
        spi_send_recv(m_tx_data, m_rx_data, 0);
    }
    #endif
    

    is there anything else that i am supposed to share? if yes, please let me know

Children
No Data
Related