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

Basic UART over BLE?

I'm trying to enable basic commands with my device. Ideally I have a terminal open on a mac running nodejs or use the UART subapp in the nRF Toolbox App, type a special command character then press transfer.

There are a handful of apps in the examples that have uart somewhere in the name, but none of them seem to be able to simply abstract a put_char and on_char_received...as far as I've found. That's really all I'm looking for: Push a character out to the Tx buffer and then get an interrupt on a character received.

I'm tested with examples:

  • ble_app_hrs_s110_uart_pca10028
  • ble_app_hrs_s110_uart_stm_pca10028
  • ble_app_hts_s110_uart_pca10028
  • ble_app_proximity_s110_uart_pca10028
  • ble_app_uart_s110_pca10028

All the ROM and RAM settings under Options for Target -> Target are immediately wrong and it just gave me qualms about using this as a learning point in general. I did however get something from ble_app_uart_s110_pca10028.

What is the most relevant example to consider when using the S110 soft device and working with a PCA10028 dev board? What is the simplest way for me to integrate the simple firmware API of put_char and on_char_received into my own firmware project?

  • Hi la-ble,

    I am not sure if I understand what you mean by abstract put_char and on_char_received. Are you saying that you do not need to forward BLE traffic to/from UART? Or are you asking if you can use NUS service and also abstract put_char and on_char_received functions in addition to NUS?

    I will help you and edit my answer after I understand what you are really looking for

  • @Aryan, I do NOT care about the UART hardware peripheral. I only care about sending/receiving debug data over BLE to/from an iOS device. 'Emulated' UART might be a better description I could have put down.

  • If the memory settings are incorrect, you are probably using the incompatible SDK and SoftDevice.

    It sounds like ble_app_uart is a very good starting point for your application

    in ble_uart you send a string from the terminal on the PC over UART to the nRF51, then the string is relayed over BLE to peer APP with ble_nus_string_send().

    You send a string from the APP over BLE to the nRF51, then the string is relay to the terminal on the PC over UART with nus_data_handler().

    To send data to your phone from nRFchip: just call ble_nus_string_send

    When you receive data over BLE from your phone nus_data_handler will be called, so you have handle your incoming character

  • @Aryan, the example is not working for me using PCA10028, SDK v8.0.0, S110 v8.0.0. The APP shows RX logs but NOT TX logs no matter the size of the message I send or hardcode, with or without a newline character. If I skip over uart and fifo (directly echo back what comes in on nus_data_handler out to ble_nus_string_send) then I can get TX logs. app_uart and app_fifo seem to break the example.

Related