ARMmbed / ble-x-nucleo-idb0xa1

port of BLE_API to ST BLE shield
14 stars 5 forks source link

X-NUCLEO-IDB05A1 connection with PyBoard v1.1 #20

Closed dmazzella closed 7 years ago

dmazzella commented 7 years ago

Hi Andrea, I'm trying to connect a PyBoard with the X-NUCLEO-IDB05A1 extension board, but I have problems. Have you ever tried to connect to the X-NUCLEO-IDB05A1 with a board other than a Nucleo? Any suggestions?

apalmieriGH commented 7 years ago

Hi Damiano, I successfully connected the X-NUCLEO-IDB05A1 with other boards (listed here) as well as Arduino UNO board. Unfortunately, I never used the PyBoard. In any case, you need 6 PINs (MISO MOSI CLK CS IRQ and RST) to drive the X-NUCLEO-IDB05A1. What issues are you facing?

dmazzella commented 7 years ago

Hi Andrea, i have wrote BLE driver in pure python for micropython and implemented all vs hci commands supported by BlueNRG, BlueNRG-MS and SPBTLE-RF.

I also built an expansion board with SPBTLE-RF and i have no problems with this board, but with X-NUCLEO-IDB05A1 i have some problems ...

i have connected the PyBoard with X-NUCLEO-IDB05A1 as you can see:

x_nucleo_idb05a1_mbed_pinout_v1

pybv11-pinout

I have tryed to execute 'hci_le_read_local_version' and these are the results ...

With my board i can see:

MicroPython v1.8.7-461-g58f23def-dirty on 2017-03-23; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>> from basic import Basic; ble = Basic(); ble.run()
INFO:examples.basic hci_verify: 04ff03010001
INFO:examples.basic <HCI_UART pkt_type=EVENT(0x04) data=ff03010001>
INFO:examples.basic <HCI_EVENT evtcode=VENDOR(0xff) subevtcode=BLUE_HAL_INITIALIZED(0x01) length=3 data=010000>
INFO:examples.basic write: 027f000000
INFO:examples.basic hci_send: 01011000
INFO:examples.basic hci_verify: 040e0c010110000707310730002300
INFO:examples.basic <HCI_UART pkt_type=EVENT(0x04) data=0e0c010110000707310730002300>
INFO:examples.basic <HCI_EVENT evtcode=CMD_COMPLETE(0x0e) length=12 data=010110000707310730002300>
INFO:examples.basic EVT_CMD_COMPLETE
INFO:examples.basic current version 7.2c
>>>

But with X-NUCLEO-IDB05A1 i can see:

MicroPython v1.8.7-461-g58f23def-dirty on 2017-03-23; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>> from basic import Basic; ble = Basic(); ble.run()
INFO:examples.basic hci_verify: 04ff03010001
INFO:examples.basic <HCI_UART pkt_type=EVENT(0x04) data=ff03010001>
INFO:examples.basic <HCI_EVENT evtcode=VENDOR(0xff) subevtcode=BLUE_HAL_INITIALIZED(0x01) length=3 data=010000>
INFO:examples.basic write: 02000001ff
INFO:examples.basic write: 0001ffffff
INFO:examples.basic write: 0001ffffff
INFO:examples.basic write: 0001ffffff
INFO:examples.basic write: 02000001ff
INFO:examples.basic write: 0001ffffff
INFO:examples.basic write: 0000000000
INFO:examples.basic write: 0000000000
INFO:examples.basic write: 0000000000
INFO:examples.basic write: 0000000000
INFO:examples.basic write: 0000000000
INFO:examples.basic write: 0000000000
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "basic.py", line 47, in run
  File "bluetooth_low_energy/modules/st_microelectronics/bluenrg_ms.py", line 1, in get_version
  File "bluetooth_low_energy/modules/base_hci.py", line 1, in hci_le_read_local_version
  File "bluetooth_low_energy/modules/st_microelectronics/bluenrg_ms.py", line 1, in hci_send_cmd
  File "bluetooth_low_energy/modules/st_microelectronics/bluenrg_ms.py", line 1, in hci_send
RuntimeError: Maximum retry
>>>

the problem would seem to be that when i send '0A00000000' the buffer returned from SPBTLE-RF SP is '02000001ff'

As described into UM186 ready byte is '02' but the 2nd byte contains write buffer size is '00'

any hint on this? You've never had this kind of problem?

apalmieriGH commented 7 years ago

Hi Damiano,

both boards basically use the same module (SPBTLE-RF) so they should have the same behavior. Please, take into account the Warning reported on this X-NUCLEO-IDB05A1 library page concerning SPI CLK Pin.

Kind regards

dmazzella commented 7 years ago

Solved, thanks and kind regards