Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52840 Reporting to Arduino LCD shield?

Hi there!

Working with the nRF52840 DK, I am wondering how I might modify an existing SDK example in order to display the Tx and Rx Power characteristic on a hardware connected LCD display?

That is, rather than using a BLE-UART example, I'd like to interface with an Arduino (or others?) LCD shield mounted on the DK. 

I'v tried a few things that I thought might produce a quick result, but I find that I don't really know what I'm looking for as far the software. 

My next theory is maybe to somehow report this characteristic to the LCD over the TWI/I2C bus? But again, still a little lost on that. 

I've been using the most current SDK and Soft Device. I've been successfully using Keil to build and flash other, simpler modified example code (and Soft Device) to the DK, but the TWI is getting tricky for me. 

Open to other suggestions on how to achieve this. 

Beyond the Tx/Rx Signal, eventually I'll be looking to report the power consumption and battery level on the LCD as well. 

Many thanks for your time, 

Cheers, 

Sam

Parents
  • Hello,

    This question is really divided in two, and I suggest that you do that with the development as well.

    1: You need to be able to fetch all the data that you at a some point want to display on the screen, but start with checking that you are able to view it in the log.

    2: You need to be able to communicate with the screen.

    I am not sure whether you have started looking into any of these yet, but I suggest that you try to separate these tasks first. 

    For 2), I suggest that you look into the example found in:

    SDK\examples\peripheral\gfx, as this is an LCD screen example. If you use another LCD screen than the ones supported in this example, you must find some drivers that works for your screen. You can find the testing description for this example here.

    Best regards,

    Edvin

  • Edvin, 

    I hope you don't mind me coming back to this. We took you up on your advice about eventually remapping the SPI pins to our custom pins, and simply using an ILI9341 controlled LCD Display. We settled on the 2.8in TFT SPI Module

    *No SPI pins were remapped at this point*

    To be efficient, we are just quickly setting it up to work with the gfx SDK example out of the box. The pins were a little tricky to figure out, as they don't quite match SPI X-wire formats. But, we believe we were able to wire it to our nRF52840 PDK with 2x checked accuracy. 

    Problem is: Running the gfx example leaves a blank display (LED back light is lit). 

    Given the hardware mentioned, do you foresee an issue that might cause this symptom?

Reply
  • Edvin, 

    I hope you don't mind me coming back to this. We took you up on your advice about eventually remapping the SPI pins to our custom pins, and simply using an ILI9341 controlled LCD Display. We settled on the 2.8in TFT SPI Module

    *No SPI pins were remapped at this point*

    To be efficient, we are just quickly setting it up to work with the gfx SDK example out of the box. The pins were a little tricky to figure out, as they don't quite match SPI X-wire formats. But, we believe we were able to wire it to our nRF52840 PDK with 2x checked accuracy. 

    Problem is: Running the gfx example leaves a blank display (LED back light is lit). 

    Given the hardware mentioned, do you foresee an issue that might cause this symptom?

Children
  • Let us assume that you didn't change much in the gfx example.

    By default, it uses the configuration of the ili9341, which is the one you are using.

    By default in this project, the following pins are set on the nRF52840:

    SCK(clock): P1.15

    MISO(SDO): P1.14

    MOSI(SDI): P1.13

    SS/CS: P1.12

    These should be connected to the corresponding pins on the screen, respectively: SCK, SDO, SDI, CS. In addition, you need to supply it with GND and VDD (0V and 3V), and for good measure, I would also connect LED (power for background light) to VDD, and RESET to pin P0.18. Please also check that SB42 on the DK is not cut (it should be shorted by default, so if you haven't cut it, it is fine).

    What does the log from the gfx application say when you run it?

    Best regards,

    Edvin

  • Edvin, 

    Thank you for staying with me here so far, your help is much appreciated. I've double checked our connections with the pin-out you've provided above. Indeed they were the same as we've had them configured so far. Any thoughts on the 'DC' pin labeled on the LCD PCB? Looking at the data sheet of the LCD Display, it seems that pin would be best pulled to Ground or N.C. for this \gfx example. So far, we've had it N.C.

    So, starting with that, our next steps will have to be checking the display for issues, and finally with a different 840 DK. Any chance you have some insight as to what's going on?

    Thanks again, 

    Sam

  • I don't think DS pins are standard SPI pins. I found this, however. Just try to set it low and high, to see whether one works and one doesn't.

  • What you can do, on the nRF side, you can try to analyze the SPI pins using a logic analyzer to see whether the data is actually coming out from the nRF. Another thing you can check is what SPI mode you screen use. If you look in the hardware_init() function, which sets up the spi:

        nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
    
        spi_config.sck_pin  = ILI9341_SCK_PIN;
        spi_config.miso_pin = ILI9341_MISO_PIN;
        spi_config.mosi_pin = ILI9341_MOSI_PIN;
        spi_config.ss_pin   = ILI9341_SS_PIN;
    
        err_code = nrf_drv_spi_init(&spi, &spi_config, NULL, NULL);
        return err_code;

    The NRF_DRVI_SPI_DEFAULT_CONFIG uses NRF_DRV_SPI_MODE_0. Try to set:

    spi_config.mode = NRF_DRV_SPI_MODE_1 to NRF_DRV_SPI_MODE_3, and see if that makes any difference. 

    And for each mode, try to connect DC to both GND and VDD.

    BR,

    Edvin

Related