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

Serialization: How to control GPIO connectivity chip

I am developing an application on a STM32 CPU that uses a 51822 through BLE serialization for BLE connectivity.

I have connected some LEDs at the pins of the 51822 to indicate the state of the application in my main CPU.

How can I send commands from my application to the BLE connectivity chip to control the GPIOs with the LEDs on the connectivity chip?

Are there already some commands in the serialization protocol for this purpose?

  • You have to implement these commands by yourself. There is source code of serialization project in SDK, so it shouldn't be hard to modify it.

  • I have worked out that on the side of the connectivity chip the right place to handle user commands is the function ser_conn_received_pkt_process() in the module ser_conn_pkt_decoder.c. Here I can decode user commands.

    But on application side, I could not work out yet what is the expected way to send a user command. I have to use tx_buf_alloc() and ser_sd_transport_cmd_write() to start a transfer. It would be handy if there is an example implementation or even a stub for a user command transfer in the library routines.

  • Hi Christian,

    We don't have an example or supported in the library yet. But you are correct about using tx_buf_alloc() to set the buffer and then use ser_sd_transport_cmd_write() to send the command. You just need to define your own GPIO API (addition to the SVC APIs of the softdevice). So that you can process the packet accordingly in ser_conn_received_pkt_process() on the connectivity chip.

  • To access the local resources on the connectivity chip, I have added to additional commands to the protocol: uint32_t sd_ble_conn_chip_reg_set( ble_conn_chip_reg_set_t reg_set ); uint32_t sd_ble_conn_chip_reg_get( ble_conn_chip_reg_get_t reg_get );

    With the new commands, I can set any register to configure the peripherals and write output values, and I can get values from any register to read results.

    Configuration of GPIOs as outputs and writing values is now possible, also I can setup the ADC and read back measured values.

    May be this is a interesting extension for the serialization module. If someone is interested, I can deliver a example implementation based on SDK 11 and Softdevice S130.

    nrf_soc_reg.h

Related