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

Programming an LCD with nRF51 using SPI

Hi,

Would anyone be able to upload a template code for programming an LCD using the nRF51822 or nRF51422 with SPI?

I am using Sharp’s LS013B4DN04 Memory LCD. Here's the datasheet: www.sharpmemorylcd.com/.../ls013b4dn04_application_info.pdf

I am having difficulty identifying all the methods to instantiate Chip Select, SIMO and CLK pins on the LCD, divide up data into appropriate byte lengths and register receipt by the LCD of the data received.

Your help would be really greatly appreciated! Thanks for your time.

  • @LK13131: Have you tried to play with our SPI example and the spi driver in our SDK ?

  • Hi Hung Bui,

    Yes, I have explored the spi_master example and I have tried to complete the following 5 steps for establishing an SPI connection to the LCD screen, which I found on another posted question on this forum:

    devzone.nordicsemi.com/.../

    1. Control the SS pin manually by configuring it as a GPIO output and and setting it high initially.
    2. Break your data into 255 byte chunks Before sending data set SS low.
    3. Call nrf_drv_spi_transfer() for first chunk
    4. Wait for SPI event handler to know when transfer is complete
    5. Repeat 4-5 until all data is transferred, then set SS high.

    To follow these steps, I added the following code to main(): (data is random data for an 'image')

    //Control the SS pin manually by configuring it as a GPIO output and and setting it high initially.
    nrf_gpio_cfg_output(SPI_SS);
    nrf_drv_gpiote_out_set(SPI_SS);
    
    //Break your data into 255 byte chunks
    data = {{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5}};
    
    //Before sending data set SS low
    nrf_drv_gpiote_out_clear(SPI_SS);	
    
    //Call nrf_drv_spi_transfer() for first chunk
    nrf_drv_spi_transfer(p_instance, p_tx_buffer, TX_RX_MSG_LENGTH, p_rx_buffer, TX_RX_MSG_LENGTH);
    
    //Wait for SPI event handler to know when transfer is complete
    
    //Repeat 4-5 until all data is transferred, then set SS high.
    nrf_drv_gpiote_out_set(SPI_SS);
    
  • @LK: Please don't attach the long source code, it's not possible to read anyway. Please remove them and add a file instead. I still don't know what is the issue ? Have you tried to request the library or example code from the LCD manufacturer ?

Related