Concurrent Central/Peripheral UART

Maxim01 gravatar image

asked 2017-02-16 14:29:16 +0100


I'am actually trying to develop a BLE based remote, with NRF52832, S132.

This remote must be configured by a smartphone (the remote act as peripheral) and be able to control one equipement (and act as Central).

As i only need to use uart on each side, i've started mixing demo programs ble_app_uart_c.c (central) and ble_app_uart.c (peripheral) without success.

As peripheral: The board advertise correctly, i can connect to it on my smartphone with the app nRF UART v2.0 but the NUS_data_handler seems not receive any message.

As central: When the board try to connect with another board flashed with ble_app_uart.c, the conn_handle indicate 65532 and the role is BLE_GAP_ROLE_INVALID instead of BLE_GAP_ROLE_CENTRAL.

RAM configuration: start: 0x20003DB0, size: 0xC250

My program: ble_app_uart_c.zip

Thanks a lot for your advice to correct these errors !!!

edit retag flag offensive close delete report spam

1 answer

Sort by » oldest newest most voted
joh2 gravatar image

answered 2017-02-17 16:28:40 +0100


It does not look like you are handling received advertising reports in your application.

When your central receives an advertising packet, the role will be set to BLE_GAP_ROLE_INVALID, but the event ID will indicate BLE_GAP_EVT_ADV_REPORT.

You should dispatch such events to the on_ble_central_evt() handler. Have a look at for instance the BLE Relay Example (concurrent central/peripheral) for more details about how this is done.

Best regards,


edit flag offensive delete publish link more


Thanks a lot for your help Jørgen, it works perfectly with this ! And for the peripheral function we must add ble_nus_on_ble_evt(&m_nus, p_ble_evt); on the dispatch peripheral to retreive the messages.

Maxim ( 2017-02-20 08:20:41 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

Question Tools

1 follower


Asked: 2017-02-16 14:29:16 +0100

Seen: 163 times

Last updated: feb. 17