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

  • For 2)

    After some research on a compatible LCD, it seems the two controllers supported in the gfx example require the SPI pins. This is going to be a problem for me because eventually this application is to be migrated to a 3rd party board in which the SPI pins are not available. Disappointed

    So, moving on to a different LCD controller, I found a lot of documentation & support for the Hitachi HD44780. If I include all the appropriate drivers/libraries and dependencies, should be able to display some characters from the DK right? Has anyone used the Hitachi HD44780 controller on the PCA10056 before?

    Thanks again for your time. 

  • 1)

    Depends on what you want to do. Are you going to actually connect, or just fetch RSSI (signal strength) from advertising devices? Either way, you should look into one of the examples from the SDK\examples\ble_central folder. The examples here will typically look for a specific advertising device, and try to connect to that device. You can try to remove the filters that are applied by removing nrf_ble_scan_filter_set() and nrf_ble_scan_filters_enable(). Then try to add the BLE_GAP_EVT_ADV_REPORT event to your ble_evt_handler() in main.c.

    Then you will get this event every time you pick up an advertisment packet. Inside this event, these parameters will probably be interesting for you:

    p_ble_evt->evt.gap_evt.params.adv_report.data.p_data
    p_ble_evt->evt.gap_evt.params.adv_report.data.len
    p_ble_evt->evt.gap_evt.params.adv_report.rssi
    p_ble_evt->evt.gap_evt.params.adv_report.peer_addr.addr[]   // addr[0] -> addr[5]
    

    2)

    as for the display, you can try to change it from using SPI to I2C/TWI. I just thought that this example would be a good starting point to get the screen up and running.

    You can look into changing the init and send functions to set up TWI instead of SPI.

    Unknown said:
    this application is to be migrated to a 3rd party board in which the SPI pins are not available

    Not quite sure I follow you here. The SPI pins aren't available? You can use any pins as SPI pins on the nRF.

    Best regards,

    Edvin

Reply
  • 1)

    Depends on what you want to do. Are you going to actually connect, or just fetch RSSI (signal strength) from advertising devices? Either way, you should look into one of the examples from the SDK\examples\ble_central folder. The examples here will typically look for a specific advertising device, and try to connect to that device. You can try to remove the filters that are applied by removing nrf_ble_scan_filter_set() and nrf_ble_scan_filters_enable(). Then try to add the BLE_GAP_EVT_ADV_REPORT event to your ble_evt_handler() in main.c.

    Then you will get this event every time you pick up an advertisment packet. Inside this event, these parameters will probably be interesting for you:

    p_ble_evt->evt.gap_evt.params.adv_report.data.p_data
    p_ble_evt->evt.gap_evt.params.adv_report.data.len
    p_ble_evt->evt.gap_evt.params.adv_report.rssi
    p_ble_evt->evt.gap_evt.params.adv_report.peer_addr.addr[]   // addr[0] -> addr[5]
    

    2)

    as for the display, you can try to change it from using SPI to I2C/TWI. I just thought that this example would be a good starting point to get the screen up and running.

    You can look into changing the init and send functions to set up TWI instead of SPI.

    Unknown said:
    this application is to be migrated to a 3rd party board in which the SPI pins are not available

    Not quite sure I follow you here. The SPI pins aren't available? You can use any pins as SPI pins on the nRF.

    Best regards,

    Edvin

Children
  • Thanks so much for the info. As far as the display, you make a good point. I may go back to reconsidering just how I go about the actual display, bearing this in mind. So thank you. 

    As far as the reporting, I am, in fact, hoping to fetch data that have to do with an actual Bluetooth connection. Actually, the entire scheme will involve one board running ble multi-link central firmware while connected to three (3) other boards running ble_peripheral firmware. The only two parameters I'm really after are the Tx Signal strength to reference with as well as the Rx sensitivity of each connection (displayed on the central board). Can you point me to some of these parameters? Or resources?

    Thanks again for your time, 

    Sam

  • Update on the Received Signal Strength Reporting:

    The only two parameters I'm really after are the Tx Signal strength to reference with as well as the Rx sensitivity of each connection (displayed on the central board). Can you point me to some of these parameters? Or resources?

    Was able to log the rssi of the current connection to the console by use of the sd_ble_gap_rssi_start() and sd_ble_gap_rrsi_get() wrapped in a BLE_GAP_EVT_RSSI_CHANGED event to the handler. So, similar to what you mentioned in your initial reply. Really appreciate the guidance here mate. 

Related