Comments (29)
can you provide details about physical connection between pyboard and spbtle-rf? es. photos, pin numbers ecc
from uble.
I suggest the "basic" example as a starting point
from uble.
on pyboard, I'm using the SPI 2:
PYBOARD=>expansion BLE
Y8(mosi) =>PA6 (miso)
Y7(miso)=>PA7 (mosi)
Y6(sck)=>PA5 (sck)
Y5(ss)=>PB6 (css)
link to the BLE board http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idb05a1.html
layout of the BLE board
http://www.st.com/content/ccc/resource/technical/layouts_and_diagrams/schematic_pack/d4/79/0d/ce/43/ac/4b/19/x-nucleo-idb05a1_schematic.pdf/files/x-nucleo-idb05a1_schematic.pdf/jcr:content/translations/en.x-nucleo-idb05a1_schematic.pdf
from uble.
Current pins configuration is:
spi_bus=pyb.SPI(2, pyb.SPI.MASTER, baudrate=8000000, polarity=0),
nss_pin=pyb.Pin('Y5', pyb.Pin.OUT_PP),
sck_pin=None,
miso_pin=None,
mosi_pin=None,
vin_pin=pyb.Pin('X8', pyb.Pin.OUT_PP),
rst_pin=pyb.Pin('Y4', pyb.Pin.OUT_PP),
irq_pin=pyb.Pin('Y3', pyb.Pin.IN, pyb.Pin.PULL_DOWN),
you need to provide irq, rst and vin (optional if module is connected directly on v33) pin
from uble.
I have changed the connection because there are some resistor which are not mounted like the CLK, CSN and IRQ
So here the new connection :
Y8(mosi) =>PA6 (miso)
Y7(miso)=>PA7 (mosi)
Y6(sck)=>PB3 (sck)
Y5(ss)=>PA1 (css)
Y4(rst)=>PA8
Y3(irq)=>PA0
I can import the basic project and run it but nothing happen. Below my result after I stopped with the keyboard :
from basic import Basic
p=Basic()
p.run()
Traceback (most recent call last):
File "", line 1, in
File "basic.py", line 31, in run
File "bluetooth_low_energy/modules/st_microelectronics/bluenrg_ms.py", line 431, in hci_wait_event
File "bluetooth_low_energy/modules/st_microelectronics/bluenrg_ms.py", line 423, in hci_isr
File "bluetooth_low_energy/modules/st_microelectronics/bluenrg_ms.py", line 343, in read
File "bluetooth_low_energy/modules/st_microelectronics/bluenrg_ms.py", line 325, in read
KeyboardInterrupt:
from uble.
Try to change log level from INFO to DEBUG in basic.py
Add debug_callback into basic.py
super(Basic, self).__init__(*args, **kwargs))
to
super(Basic, self).__init__(*args, debug_callback=print, **kwargs))
from uble.
from bluest_protocol import BlueSTProtocol
Traceback (most recent call last):
File "", line 1, in
File "bluest_protocol.py", line 82
SyntaxError: invalid syntax
fixed with this
from uble.
have you connected the 3V3 and GND with respective pins?
from uble.
Hi,
Yes I connected the 3V3 and GND. And I have also change the code as you said.
from uble.
And no change to the output?
from uble.
I'm going to connect a logical analyzer and check if SPI is working.
from uble.
The SPI is working
I can see the clk, Mosi and Chip select are working
But nothing from the Ble expansion board
from uble.
reset pin is working?
from uble.
# -*- coding: utf-8 -*-
import gc
gc.threshold(4096)
import logging
from bluetooth_low_energy.protocols.hci.vendor_specifics.st_microelectronics.bluenrg_ms.event import (
EVT_BLUE_HAL_INITIALIZED)
from bluetooth_low_energy.protocols.hci.vendor_specifics.st_microelectronics.bluenrg_ms.constant import (
RESET_NORMAL)
from bluetooth_low_energy.modules.st_microelectronics.spbtle_rf import (
SPBTLE_RF)
logging.basicConfig(level=logging.INFO)
log = logging.getLogger("examples.basic")
class Basic(SPBTLE_RF):
"""
Simple example for print BlueNRG-MS firmware versione
"""
def __init__(self, *args, **kwargs):
super(Basic, self).__init__(
*args,
debug_callback=lambda x: log.info("@@@@ %r", x),
**kwargs)
def run(self, timeout=100):
# Reset BlueNRG-MS
self.reset()
# Check Evt_Blue_Initialized
if self.hci_wait_event(
subevtcode=EVT_BLUE_HAL_INITIALIZED
).struct.reason_code != RESET_NORMAL:
raise ValueError("reason_code")
# Get the BlueNRG FW versions
version = self.get_version()
log.info("current version %s", version)
i have added debug_callback=lambda x: log.info("@@@@ %r", x),
and running this example i can see:
MicroPython v1.8.7-395-gf5aac7d3-dirty on 2017-03-13; 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 object at 20011520>
INFO:examples.basic @@@@ <HCI_EVENT object at 20011cc0>
INFO:examples.basic @@@@ 'hci_send: 01011000 '
INFO:examples.basic @@@@ 'hci_verify: 040e0c010110000707310730002300'
INFO:examples.basic @@@@ <HCI_UART object at 20011b70>
INFO:examples.basic @@@@ <HCI_EVENT object at 20011d90>
INFO:examples.basic @@@@ 'EVT_CMD_COMPLETE'
INFO:examples.basic current version 7.2c
>>>
from uble.
IRQ and RST are not working
and I have also add debug_callback=lambda x: log.info("@@@@ %r", x),
but I still have nothing
from uble.
MicroPython v1.8.7-395-gf5aac7d3-dirty on 2017-03-13; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>> from basic import Basic; ble = Basic();
>>> ble.hci_reset()
INFO:examples.basic @@@@ 'hci_send: 01030c00 '
INFO:examples.basic @@@@ 'hci_verify: 04ff03010001'
INFO:examples.basic @@@@ <HCI_UART object at 20011910>
INFO:examples.basic @@@@ <HCI_EVENT object at 20011cf0>
INFO:examples.basic @@@@ 'EVT_VENDOR'
INFO:examples.basic @@@@ 'hci_verify: 040e0401030c00'
INFO:examples.basic @@@@ <HCI_UART object at 200112b0>
INFO:examples.basic @@@@ <HCI_EVENT object at 20011d00>
INFO:examples.basic @@@@ 'EVT_CMD_COMPLETE'
<HCI_COMMAND object at 20010df0>
>>> ble.get_version()
INFO:examples.basic @@@@ 'hci_send: 01011000 '
INFO:examples.basic @@@@ 'hci_verify: 04ff03010001'
INFO:examples.basic @@@@ <HCI_UART object at 200119d0>
INFO:examples.basic @@@@ <HCI_EVENT object at 20011e10>
INFO:examples.basic @@@@ 'EVT_VENDOR'
INFO:examples.basic @@@@ 'hci_verify: 040e0c010110000707310730002300'
INFO:examples.basic @@@@ <HCI_UART object at 200125a0>
INFO:examples.basic @@@@ <HCI_EVENT object at 200126c0>
INFO:examples.basic @@@@ 'EVT_CMD_COMPLETE'
'7.2c'
>>>
try to call ble.hci_reset()
from uble.
I got this
from basic import Basic
ble= Basic()
ble.hci_reset()
Traceback (most recent call last):
File "", line 1, in
File "bluetooth_low_energy/modules/base_hci.py", line 135, in hci_reset
File "bluetooth_low_energy/modules/st_microelectronics/bluenrg_ms.py", line 464, in hci_send_cmd
File "bluetooth_low_energy/modules/st_microelectronics/bluenrg_ms.py", line 533, in hci_send
RuntimeError: Maximum retryble.get_version()
Traceback (most recent call last):
File "", line 1, in
File "bluetooth_low_energy/modules/st_microelectronics/bluenrg_ms.py", line 539, in get_version
File "bluetooth_low_energy/modules/base_hci.py", line 155, in hci_le_read_local_version
File "bluetooth_low_energy/modules/st_microelectronics/bluenrg_ms.py", line 464, in hci_send_cmd
File "bluetooth_low_energy/modules/st_microelectronics/bluenrg_ms.py", line 533, in hci_send
RuntimeError: Maximum retry
from uble.
I'm sorry but there is some problem with the connection to the module.
I currently do not own an "x-core-idb05a1", as soon as they go into the possession I can give a helping hand in this regard.
from uble.
ok.
Can you just tell how did you connect the Pyboard to expansion BLE ?
BTW can you confirm that i'm using the good expansion board. http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idb05a1.html
from uble.
I have built my custom expansion board for pyboard
into Fritzing for breakout you can see connections and components used.
I just ordered the expansion card x-core-idb05a1, when will be in my possession, I can do some testing.
from uble.
Tell me when you can test it please :)
I have noticed something. On the expansion card x-core-idb05a1 the RST and CSN are connected to the VDD. Don't you think I should disconnect it ?? Can you compare with your schematic please?
from uble.
if you install fritzing you can see schematic of the my board and compare with schematic of x-core-idb05a1
i can test x-core-idb05a1 into next 2 days
from uble.
I have started tests with x-nucleo-idb05a1 with this connections:
MicroPython v1.8.7-438-g5640e6da-dirty on 2017-03-17; 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>
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
>>>
in the next few days I hope to say more
from uble.
ok
Let me know when you have more information
from uble.
ok, i have solved some problems into uble core and now with X-NUCLEO-IDB05A1 i can see:
MicroPython v1.8.7-570-g468c6f9d-dirty on 2017-04-04; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>> from basic import Basic; ble = Basic(); ble.run()
read 0 bytearray(b'\x02\x7f\x00\x00\x00')
read 0 bytearray(b'\x02\x7f\x00\x06\x00')
read 1 bytearray(b'\x04\xff\x03\x01\x00\x01')
hci_isr bytearray(b'\x04\xff\x03\x01\x00\x01')
write 0 bytearray(b'\x00\x00\x00\x00\x00')
write 0 bytearray(b'\x02\x7f\x00\x00\x00')
write 1 bytearray(b'\xff\xff\xff\xff')
read 0 bytearray(b'\x02\x7f\x00\x00\x00')
read 0 bytearray(b'\x02\x7f\x00\x0f\x00')
read 1 bytearray(b'\x04\x0e\x0c\x01\x01\x10\x00\x07\x071\x070\x00\x15\x00')
hci_isr bytearray(b'\x04\x0e\x0c\x01\x01\x10\x00\x07\x071\x070\x00\x15\x00')
INFO:examples.basic:733787181 current version 7.1e
as soon as possible I will release a stable version.
from uble.
fixed with this commit
can you please test it?
from uble.
Connections with extension board X-NUCLEO-IDB05A1:
from uble.
Perfect !
I have tested the sensorDemo and the BlueSTProtocol demo
It's working good !
I will let you know when I will have aprototype of my solution for the sensor board !
from uble.
👍🏻
from uble.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uble.