dev kit SX1280ED1ZHP support?

344 views
Skip to first unread message

Gurvan Rivallan

unread,
Mar 19, 2023, 1:02:55 PM3/19/23
to btstack-dev
Good morning.
I'm working on a bluetooth development kit: SX1280ED1ZHP.
But I don't know if I can use your BTstack.
The SX1280 component only has a physical layer so I need a link layer and HCI, but I saw you have examples using this radio chip.
Could you help me?
I hope you will help me.

Matthias Ringwald

unread,
Mar 20, 2023, 9:50:12 AM3/20/23
to btsta...@googlegroups.com
Hi Gurvan

I'd call the SX1280ED1ZHP a LoRa development kit with ambitions for Bluetooth LE :)

We did implement a minimal link layer / controller subsystem for the SX1280 and called it Cinnamon. While developing it, we first tried with the SX1280ED1ZHP, but after not being able to communicate with it at full SPI speed realized that Semtech did place current-limiting resistors on their shield - it's well documented in the schematic, but it didn't catch my attention.

The problem is that this limits the SPI speed to about 5 Mhz, but we only managed to get a working Bluetooth connection at full speed. The resistors are very tiny and placed very close to each other.
Instead of trying to fix the devkit, we switched to Miromico FMLR-80-P-STL4E modules (https://miromico.ch/portfolio/fmlr-8x-x-stlx/). Later, we've also created a simple shield with a module from AliExpress as well:
https://github.com/bluekitchen/sx1280-shield

The repo has ports for these two:
- https://github.com/bluekitchen/btstack/tree/master/port/stm32-l451-miromico-sx1280
- https://github.com/bluekitchen/btstack/tree/master/port/stm32-l476rg-nucleo-sx1280

What would you like to use the SX1280 with BTstack use for?

Best
Matthias
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/ee04e4ff-cb61-499a-ba3b-18e194ea54a7n%40googlegroups.com.

Gurvan Rivallan

unread,
Mar 20, 2023, 11:58:24 AM3/20/23
to btstack-dev
Thank you for your reply.
I will use the AliExpress module instead. I would just like to communicate from my phone with the SX1280 radio chip in BLE, to receive data like for example the battery level of my system. I am new to the bluetooth protocol but after checking your github, the "gatt_counter" example seems the most appropriate for my use? with my phone playing the client/central role and the sx1280 playing the server/peripheral role?

I hope you will help me. 

Best
Gurvan


Matthias Ringwald

unread,
Mar 21, 2023, 1:34:49 PM3/21/23
to btsta...@googlegroups.com
Hi Gurvan

Do you also want to use the LoRa and other radio modes of the SX1280? Our example port only supports a BLE Peripheral.

Yes, the gatt_counter example allows to connect from a mobile phone to the SX1280 and exchange data. I'd suggest to use the same STM32 devkit, an L476RG in this case, as we had to optimize the SPI driver of the STM32 L4 HAL a bit to get it working.

Best
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/4674759e-6fd3-4b04-a4a2-a6f1ec2e6764n%40googlegroups.com.


Gurvan Rivallan

unread,
Mar 22, 2023, 5:21:06 AM3/22/23
to btstack-dev
Hello Matthias

I only want to use the BLE radio mode of the SX1280 for the moment.
Thank you very much for your answers.

I have another question. To start with I want to use a bluetooth dongle as a server and try to connect to it with my phone with the LightBlue app.

1. I connected BTDongle (BLED112-V1) and replaced driver using Zadig
   Chosen- WinUSB

2. Using MSYS2 MinGW 64-Bit
   I was able to make the project 

3. Using winpty, i am able to run gatt_counter.exe

4. From remote device - my mobile, I can't see my bluetooth key after scanning the Bluetooth LE devices 
In the device manager I see my bluetooth dongle, in "universal serial bus device".

when I using winpty i have only that:

Packet Log: hci_dump.pklg
BTstack counter 0001

in wireshark, I have this log : 

1 0.000000 PKTLOG hci_transport_h2_winusb.c.406: registering packet handler
2 1.000000 PKTLOG hci.c.5065: hci_power_control: 1, current mode 0
3 1.000000 PKTLOG hci_transport_h2_winusb.c.1102: WinUSB                         00007ff8f5060000
4 1.000000 PKTLOG hci_transport_h2_winusb.c.1103: WinUsb_QueryPipeEx             00007ff8f5061210
6 1.000000 PKTLOG hci_transport_h2_winusb.c.1105: WinUsb_ReadIsochPipe           00007ff8f5064180
5 1.000000 PKTLOG hci_transport_h2_winusb.c.1104: WinUsb_RegisterIsochBuffer     00007ff8f5063800
7 1.000000 PKTLOG hci_transport_h2_winusb.c.1106: WinUsb_ReadIsochPipeAsap       00007ff8f5064130
8 1.000000 PKTLOG hci_transport_h2_winusb.c.1107: WinUsb_WriteIsochPipe          00007ff8f5063da0
9 1.000000 PKTLOG hci_transport_h2_winusb.c.1108: WinUsb_WriteIsochPipeAsap      00007ff8f5063d70
10 1.000000 PKTLOG hci_transport_h2_winusb.c.1109: WinUsb_UnregisterIsochBuffer   00007ff8f50639b0
11 1.000000 PKTLOG hci_transport_h2_winusb.c.1110: WinUsb_GetCurrentFrameNumber   00007ff8f5063600
12 2.000000 PKTLOG hci_transport_h2_winusb.c.1151: usb_open: SetupDiGetClassDevs -> 0000025b97e3cf30
14 2.000000 PKTLOG hci_transport_h2_winusb.c.978: Opening USB device: ffffffffffffffff
13 2.000000 PKTLOG hci_transport_h2_winusb.c.1201: usb_open: Device Path: \\?\usb#vid_0461&pid_4d15#6&2a0b5975&0&2#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
15 2.000000 PKTLOG hci_transport_h2_winusb.c.1090: usb_try_open_device: last error 6
16 2.000000 PKTLOG hci_transport_h2_winusb.c.1228: usb_open: Device open failed
17 2.000000 PKTLOG hci_transport_h2_winusb.c.1201: usb_open: Device Path: \\?\usb#vid_0bda&pid_57c3#200901010001#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
18 2.000000 PKTLOG hci_transport_h2_winusb.c.978: Opening USB device: 00000000000001c4
19 64.000000 PKTLOG hci_transport_h2_winusb.c.1090: usb_try_open_device: last error 8
20 64.000000 PKTLOG hci_transport_h2_winusb.c.1228: usb_open: Device open failed
21 64.000000 PKTLOG hci_transport_h2_winusb.c.1201: usb_open: Device Path: \\?\usb#vid_2458&pid_0001#1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
22 64.000000 PKTLOG hci_transport_h2_winusb.c.978: Opening USB device: 00000000000001c4
23 64.000000 PKTLOG hci_transport_h2_winusb.c.349: check vid_0a5c&pid_21e8 in \\?\usb#vid_2458&pid_0001#1#{a5dcbf10-6530-11d2-901f-00c04fb951ed} -> 0000000000000000
24 64.000000 PKTLOG hci_transport_h2_winusb.c.349: check vid_0b05&pid_17cb in \\?\usb#vid_2458&pid_0001#1#{a5dcbf10-6530-11d2-901f-00c04fb951ed} -> 0000000000000000
25 64.000000 PKTLOG hci_transport_h2_winusb.c.349: check vid_0a5c&pid_22be in \\?\usb#vid_2458&pid_0001#1#{a5dcbf10-6530-11d2-901f-00c04fb951ed} -> 0000000000000000
26 64.000000 PKTLOG hci_transport_h2_winusb.c.349: check vid_2fe3&pid_0100 in \\?\usb#vid_2458&pid_0001#1#{a5dcbf10-6530-11d2-901f-00c04fb951ed} -> 0000000000000000
27 64.000000 PKTLOG hci_transport_h2_winusb.c.349: check vid_2fe3&pid_000b in \\?\usb#vid_2458&pid_0001#1#{a5dcbf10-6530-11d2-901f-00c04fb951ed} -> 0000000000000000
28 64.000000 PKTLOG hci_transport_h2_winusb.c.1007: Class, Subclass, Protocol does not match Bluetooth device
29 64.000000 PKTLOG hci_transport_h2_winusb.c.1228: usb_open: Device open failed
30 64.000000 PKTLOG hci_transport_h2_winusb.c.1201: usb_open: Device Path: \\?\usb#vid_413c&pid_2107#6&2a0b5975&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
31 64.000000 PKTLOG hci_transport_h2_winusb.c.978: Opening USB device: ffffffffffffffff
32 64.000000 PKTLOG hci_transport_h2_winusb.c.1090: usb_try_open_device: last error 6
33 64.000000 PKTLOG hci_transport_h2_winusb.c.1228: usb_open: Device open failed
35 64.000000 PKTLOG hci_transport_h2_winusb.c.978: Opening USB device: 00000000000001c4
34 64.000000 PKTLOG hci_transport_h2_winusb.c.1201: usb_open: Device Path: \\?\usb#vid_8087&pid_0a2b#5&1548b049&0&8#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
36 64.000000 PKTLOG hci_transport_h2_winusb.c.1090: usb_try_open_device: last error 50
37 64.000000 PKTLOG hci_transport_h2_winusb.c.1228: usb_open: Device open failed
38 64.000000 PKTLOG hci_transport_h2_winusb.c.1201: usb_open: Device Path: \\?\usb#vid_0a5c&pid_5834#0123456789abcd#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
39 64.000000 PKTLOG hci_transport_h2_winusb.c.978: Opening USB device: 00000000000001c4
40 64.000000 PKTLOG hci_transport_h2_winusb.c.1090: usb_try_open_device: last error 8
41 64.000000 PKTLOG hci_transport_h2_winusb.c.1228: usb_open: Device open failed
42 64.000000 PKTLOG hci_transport_h2_winusb.c.1201: usb_open: Device Path: \\?\usb#vid_413c&pid_81b6#lf62210158011013#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
43 64.000000 PKTLOG hci_transport_h2_winusb.c.978: Opening USB device: 00000000000001c4
44 73.000000 PKTLOG hci_transport_h2_winusb.c.1090: usb_try_open_device: last error 8
45 73.000000 PKTLOG hci_transport_h2_winusb.c.1228: usb_open: Device open failed
46 76.000000 PKTLOG hci_transport_h2_winusb.c.1242: usb_open: done, r = ffffffff
47 76.000000 PKTLOG hci.c.4821: HCI_INIT failed, turning Bluetooth off again
48 76.000000 PKTLOG hci.c.7524: BTSTACK_EVENT_POWERON_FAILED
49 76.000000 controller host HCI_EVT Rcvd Unknown 0x62
50 76.000000 PKTLOG hci.c.4947: hci_power_control_on() error -1

I hope I haven't missed an important step,
thank you for all your answers

Best
Gurvan




Matthias Ringwald

unread,
Mar 22, 2023, 9:16:19 AM3/22/23
to btsta...@googlegroups.com
Hi Gurvan

The USB Bluetooth Dongle should provide the standard HCI interface. I don't know the silicon labs BLED112-V1 dongle.
The data sheet mentions "Integrated Bluetooth Low Energy stack" and "USB (virtual COM port emulation)" which most likely means that it uses some custom command.

Could you try to get a CSR 8510 (cheap, but works well), or a Laird BT-851 which you can buy at any distributor.
With an HCI dongle, the example should start and print it's Bluetooth address.

Best
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/d9ef1bc6-18d2-4ece-9c60-4812c08cd8ddn%40googlegroups.com.

Gurvan Rivallan

unread,
Mar 23, 2023, 6:20:07 AM3/23/23
to btstack-dev
Hi Matthias

Thank you for your answer, I will try it by changing the USB dongle.
I have another question, what is the procedure to test your example with the port: BTstack Port with Cinnamon for Semtech SX1280 Controller on STM32L476 Nucleo
It is just necessary to do the make command, then run the example with winpty?

Is it possible to use your example with another nucleo board of the same range, fully pinout compatible or do we have to change the code?

Thank you for all your answers.

Best
Gurvan

Matthias Ringwald

unread,
Mar 24, 2023, 10:27:52 AM3/24/23
to btsta...@googlegroups.com
Hi Gurvan

Didn't realize the readme for STM32L476/SX1280 port misses the compile/flash instructions.
Yes, you just call make to compile the 4 examples. The build will also create a .jdebug file for Ozone.
You can replace the ST-Link on the Nucleo board with a J-Link OB, then download and use Segger's Ozone to flash and debug your application.
Please see the instructions in the STM32/F4Discovery ports for details.

Other board: I'd recommend to use the same board initially as that provides a good chance that it works. if you have a similar board that maps the same MCU pins to the SPI pins on the Arduino headers
and uses the same SPI instance and it also uses the same Clock network, well, it might work as well... ;)

Best
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/7eaf3b84-41f4-48a3-b64d-c90deb0161cbn%40googlegroups.com.

Gurvan Rivallan

unread,
Mar 29, 2023, 7:46:51 AM3/29/23
to btstack-dev
Hello Matthias

finally I use the SX1280ED1ZHP dev kit, I removed the 4 resistors of 1k which manages the SPI communication. But I have a little problem, when I run the program. The LE COUNTER is visible but, when I try to connect to it, I have an error message, while using the Serial Bluetooth Terminal mobile application, I have the message connection failed: gatt status 133. Using the 'lightBlue application, I have the message No data available
Would you be able to guide me on the problem?

Matthias Ringwald

unread,
Mar 30, 2023, 3:18:45 AM3/30/23
to btsta...@googlegroups.com
Hi Gurvan

How did you replace the resistors? They are so tiny? Picures?

I have no "the Serial Bluetooth Terminal". Please try e.g. Lightblue or nRF Toolbox and check if you can connect and get a list of services.

best
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/74f0cc2f-489e-434d-b5d3-3fe1f399b4bcn%40googlegroups.com.


Gurvan Rivallan

unread,
Mar 30, 2023, 4:26:47 PM3/30/23
to btstack-dev
Hi Matthias

After unsoldering the 1k resistors, I replaced it by a small solder, I did not add any resistor, to reach the maximum frequency of 18MHz. I can't take a picture, because it's too small and my camera is not precise enough.

I am now using lightBlue but the connection is only successful 1 out of 10 times, and I don't know why...

I had another question... In the readme file you say, "The main modification was to the SPI driver that uses DMA for full packets." Which particular file did you make these changes to?

Thank you for your valuable help.

Matthias Ringwald

unread,
Mar 31, 2023, 9:39:39 AM3/31/23
to btsta...@googlegroups.com
Hi Gurvan

As the link layer is implemented on the STM32, it needs to do multiple read/write operations over SPI per packet. In addition, the interframe spacing between BLE packets is 150 us, which is very tight. Anything that causes the SPI to be slower causes connection problems.

Did you use our code unmodified on a STM32L476 Nucleo board?

The STM32 L4 HAL Cube HAL is nice and has a lot of checks to make sure it's doing the right thing. However, for the SX1280, we need to send mostly many short packets, which get slowed down a lot. We improved the speed by skipping all checks and doing all read/write in a polling loop.
See spi_tx in btstack/chipset/sx1280/SMTC_Drivers/sx1280-driver-c/sx1280_hal.c in the USE_BK_SPI section.

Best
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/3700a0a6-9f15-453b-ae1f-979e6d7e7c9en%40googlegroups.com.

Gurvan Rivallan

unread,
Mar 31, 2023, 5:20:56 PM3/31/23
to btstack-dev
Hi Matthias

Thank you for your precious answers.

I used a slightly modified version of your code to adapt it to a nucleo-STM32L457RE board, I checked the frequency of the spi on the oscilloscope and everything is fine, I don't really understand where the connection problem comes from.

I was wondering if it was possible to prevent the communication to stop in the case of error when we have several connection errors?

Best

Matthias Ringwald

unread,
Apr 3, 2023, 5:12:00 AM4/3/23
to btsta...@googlegroups.com
HI Gurvan

The SPI clock will be at the configure rate. The question is how long the pause between SPI transmission is.
After we receive a complete packet, the DIO line signals an interrupt and we need to get at least the header from the packet to see if we should repeat our last packet (missing ack), or send the next one. This must happen in less than x us, with x smaller than 150 us as the AutoTX feature fails when there's SPI communication when it needs to prepare the transmission. This is not documented.

Two options:
- could you use a BLE Sniffer and verify the interframe space (time between end of one packet and start of next packet)? it must be 150 us +/- a few us.
- you could look at the SPI traces. Again, we're interested in the time between the 'Packet' received and the time the SPI communication (multiple transfers in a short amount of time) are done. I would expect that communication works if this is below some time x and fails if it is larger than that.

Best
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/363e93b8-506f-41d2-a504-a95bf2fa583an%40googlegroups.com.


Gurvan Rivallan

unread,
Apr 4, 2023, 1:50:42 PM4/4/23
to btstack-dev
Hi Matthias
Thank you for your reply.

I'm trying to get interested in SPI traces in particular the time between a received packet and the time the spi communication is done.
It is not easy because I have the impression that the majority of the time the transactions are lower than 150us.

I had another question, is it possible to add freertos to your example on the SX1280?
I read that btstack can work in a single thread. Can I use the btstack/platform/freertos example to do this? i need to replace btstack_run_loop_embedded with btstack_run_loop_freertos?

Best

Matthias Ringwald

unread,
Apr 5, 2023, 9:13:43 AM4/5/23
to btsta...@googlegroups.com
Hi Gurvan

It's not enough to have all SPI transactions faster than 150 us. Due to unknown reasons, if SPI communication is active at some point in this 150 us, the TX will happen later,
so we've tried to be as fast as possible. The exact number for this threshold is unclear as well.

You can use BTstack with FreeRTOS if you want. In this case, you'd replace btstack_run_loop_embedded with btstack_run_loop_freertos
However, I'd recommend to stay close to the current while(1) version until the link layer and your Bluetooth code is working as expected
to keep it as simple as possible.

Best
Matthias
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/c7398385-0a7b-436b-8587-f84599fc5552n%40googlegroups.com.

Gurvan Rivallan

unread,
Apr 6, 2023, 2:30:57 PM4/6/23
to btstack-dev
Hi Matthias

Would you have an idea to solve or work around this problem?
Sometimes the communication works without problem for 10 minutes and the next time I will not even be able to connect or the connection will be lost in less than 10 seconds. This error occurs really randomly I do not understand at all. I thought I could change the value of AUTO_RX_TX_TIME_US in the link layer for example but I still have the problem. I'm still looking but if you have any idea how to solve this problem it would help me a lot.

Best 

Matthias Ringwald

unread,
Apr 8, 2023, 6:40:07 AM4/8/23
to btsta...@googlegroups.com
Hi Gurvan

Well, to improve it, you'd need to analyze a) if long SPI transactions cause a too long Inter-frame space (IFS) and b) if yes, instrument the code and improve it to shorten the SPI transactions. We've spent much time getting it to work in the first place.
The AUTO_RX_TX_TIME_US is manually hard-coded such that we get 150 us (if the SPI transfers are short enough).

What's your goal/project?

- If you want to stay with the SX1280, using a controller with a simpler SPI might help, e.g. the PIO of the Raspberry Pi Pico (RP2040) might be be used to optimize SPI transfers, in the end, the SX1280 handles some queries very slowly for
no obvious reason - e.g. clearing the interrupt flags should be instant, but takes some time.

- We have a port of our minimal Cinnamon Link Layer/Controller for the Nordic nRF5x series (port/nrf5-cinnamon). As there's no SPI communication involves, it should be robust by default.

Best
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/b803fd7d-6757-441c-a21e-0fdcd08ad799n%40googlegroups.com.


Gurvan Rivallan

unread,
Apr 11, 2023, 6:24:11 AM4/11/23
to btstack-dev
Hi Mathias

My goal is to test BLE functionality with the SX1280, using an STM32 L4 mcu.
Thank you for all your response.

In case I am going to use BTstack with freertos, should I modify the btstack_port.c function? Or I just need to create a dedicated thread for btstack?

Best
Gurvan

Matthias Ringwald

unread,
Apr 11, 2023, 10:53:33 AM4/11/23
to btsta...@googlegroups.com
Hi Gurvan

If you use want to update the STM32-SX1280 port to use FreeRTOS, i'd suggest to create a new port folder, e.g. stm32-l476rg-nucleo-sx1280-freertos, where you replace the btstack_run_loop and make necessary changes to btstack_port.c

Cheers
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/b1a63fe0-2541-4162-b445-6e3c1b8f7530n%40googlegroups.com.


Reply all
Reply to author
Forward
Message has been deleted
0 new messages