[nRF52840] UART service advertising error.

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
Sunghwan_Chung
Posts: 2
Joined: Sat Feb 10, 2018 1:27 pm
Location: South Korea

[nRF52840] UART service advertising error.

Post by Sunghwan_Chung » Tue Mar 12, 2019 1:48 pm

Hello!

I tried to send and receive UART data communication with iPhone app.
OS error found advertise function; OSError: Can not apply advertisment data. status: 0x09
I tried to advertise without params, advertise function did not return error.
But, connect with iPhone was unstable(connected and disconnected continuously) and no response for data sending.
How can I fix this?

===============

# the Nordic UART Service.
uuid_spp_vender_specific = UUID("6E400001-B5A3-F393-E0A9-E50E24DCCA9E")
uuid_spp_rx_characteristic = UUID("6E400002-B5A3-F393-E0A9-E50E24DCCA9E")
uuid_spp_tx_characteristic = UUID("6E400003-B5A3-F393-E0A9-E50E24DCCA9E")

periph = Peripheral()
service_SPP = Service(uuid_spp_vender_specific)

SPP_rx_pros = Characteristic.PROP_WRITE
SPP_rx_attrs = Characteristic.ATTR_CCCD
SPP_rx_characteristic = Characteristic(uuid_spp_rx_characteristic, props = SPP_rx_pros, attrs = SPP_rx_attrs)
service_SPP.addCharacteristic(SPP_rx_characteristic)

SPP_tx_pros = Characteristic.PROP_NOTIFY
SPP_tx_attrs = Characteristic.ATTR_CCCD
SPP_tx_characteristic = Characteristic(uuid_spp_tx_characteristic, props = SPP_tx_pros, attrs = SPP_tx_attrs)
service_SPP.addCharacteristic(SPP_tx_characteristic)

periph.addService(service_SPP)
periph.setConnectionHandler(event_handler)
periph.advertise(device_name="nRF52", services=[service_SPP])

c45713
Posts: 32
Joined: Fri Dec 09, 2016 7:09 pm

Re: [nRF52840] UART service advertising error.

Post by c45713 » Wed Mar 13, 2019 8:22 pm

As a starter, could you try out a patch for the iOS connection, to see if this solves the issue?
I have not done a PR of this yet, as i do not have a recent version of iPhone/iPad to test it out on myself in order to verify that it fixes the issue.
https://github.com/glennrub/micropython ... aa9e89762e

It relates to the raised issue:
https://github.com/micropython/micropython/issues/4288

Post Reply