I am currently having trouble making a simple UART communication (+ the HCI command-based protocol) between the X-NUCLEO-BNRG2A1 shield embedding a BlueNRG-M2 (which itself embeds a BlueNRG-2) and my Nucleo-G070RB. I cannot use SPI for this.
I also created a ST topic
First, on X-NUCLEO-BNRG2A1 side (BlueNRG-2) :
- I downloaded the FW package STSW-BNRG2N-V320
- I used the documentation UM2666 "Getting started with the X-CUBE-BLE2 Bluetooth Low Energy software expansion for STM32Cube" as support,
- I flashed the X-NUCLEO-BNRG2A1, i-e the embedded BlueNRG-2, using the BlueNRG-1_2 Flasher Utility (STSW-BNRGFLASHER), with the STSW-BNRG2N-V320 in order to emulate it with a BlueNRG-2N -I removed all Resistors / Jumpers from the SPI and unnecessary lines : (SPI_MOSI R80 & SPI_MISO R79 ), (SPI_CSN R77), (SPI_IRQ / BOOT R85 & R82) , (SPI_CS R70, R76 & R86), (GPIO R81 & R84), (Jumpers J11, J12, J13, J14, J15 (I have a doubt about J15, but I think this is just required while flashing) )
- I added all required 0 Ohm Resistors + Jumpers : R83 for DIO12 (SEL pin on BlueNRG-2N) & Jumper J10 (3v3 <-> VDD).
- I also added 0 Ohm Resistors R71 and R73 as I firstly thought these 2 lines (DIO4 & 5) were the UART lines. But if I understood correctly, these are just for application serial com when used and the emulation of BlueNRG-2N uses the DIO8 & DIO11 as UART Pins.
Then, on NUCLEO-G070RB side (STM32G0xx) :
- I have an already working project running correctly on this board
- I took the following project example: STM32L - BLE_Beacon_NWK from BlueNRG-1_2 DK 3.2.3 and extracted all I needed , using the documentation "STM32L - BlueNRG-1,2 network coprocessor (UART mode)" from the doxygen doc as support.
- I made an UART Rx/Tx module working, using the HCI commands defined in the imported libraries. This module is correctly working in:
- TX because I validated it using a USB to Serial converter on my laptop with a python script using a hci lib : the data is correctly sent.
- RX because if I make the loop TX <-> RX on the same UART, I receive exactly what was sent. I haven't tested the reception of HCI Events data, but that is not the pb here.
Finally, I mapped / configured / checked the GPIOs / buses like this:
- BlueNRG-M2SP Pins 1 & 2 untouched
- BlueNRG-M2SP Pin 3 = DIO4 = ? < --- > STM32G0xx PA9 = unused & floating
- BlueNRG-M2SP Pin 4 = DIO5 = ? < --- > STM32G0xx PA10 = unused & floating
- BlueNRG-M2SP Pin 5 = VDD is correclty at 3V3
- BlueNRG-M2SP Pins 6 & 7 untouched
- BlueNRG-M2SP Pins 8 correctly grounded
- BlueNRG-M2SP Pins 9 untouched
- EDIT " BlueNRG-M2SP Pin 11 = DIO11 = UART_RXD (BNRG-2N) " < --- > STM32G0xx PB2 = USART3_TX.
- When unconnected and BlueNRG-M2SP in correct state, pin is correclty floating
- When connected + a USB Serial converted RX wire connected, HCI data is good (interpreted by py python)
- EDIT " BlueNRG-M2SP Pin 10 = DIO8 = UART_TXD (BNRG-2N) " < --- > STM32G0xx PB0 = USART3_RX
- When unconnected and BlueNRG-M2SP in correct state, pin is correclty at 3V3, and drops to floating when BlueNRG-M2SP is in reset
- When connected to RX wire of a USB Serial converter or a Scope NOTHING, stays at 3v3
- BlueNRG-M2SP Pins 12 to 18 untouched
- BlueNRG-M2SP Pin 19 = RESETN < --- > STM32G0xx PA8 = GPO set to 1 when want to enable the BRNG. Correctly set to 1 during communication
- BlueNRG-M2SP Pin 19 = DIO12 = SEL (BNRG-2N) < --- > STM32G0xx PB4 = GPO set to 1 when want to enable the UART. Correctly set to 1 during communication
As a result, BlueNRG-M2SP should be working as BlueNRG-2N: is powered up & grounded correclty, is enabled (resetn = 1) & SEL pin = 1 for UART, has UART TX & RX mapped & receives good HCI commands, but no response and my application commands end all in timeout.
I tried swapping RX & TX just in case, nothing either.
Have I missed something ? Like the DIO 4 & 5 are maybe the ones to use ? The "emulation" FW is not UART HCI protocol compatible ?
I really appreciate any response, I am a bit in a pickle here ...
Max.Pach
Copied reply from ST community:
Nevermind, seems to come from the way you flash the BlueNRG board ...
I was using the X-NUCLEO-BNRG2A1 & the STEVAL-IDB008V2. Using the latter, I of course made the HW workarounds to enable external com without having the embedded components in the way.
Using RF Flasher and a bunch of different Example apps (DTM Uart, Beacon, the BlueNRG 2N "emulation"), no response, on both boards.
Using the BlueNRG DK graphical app, I managed to flash through UART the STEVAL-IDB008V2 with a DTM Uart image that now communicates with Both GUI & my FW on external Nucleo-G070RB. Howerver, when I compare the flash with the DTM Uart image using RF Flasher, there are differences.
I am really confused with that. This should not happen. Flashing the device with an example bin from the BlueNRG DK folders through RF Flasher should work. Now I am stuck with the X-NUCLEO-BNRG2A1 not working as there is no way to program it using the BlueNRG DK graphical app.
So what I am missing there ? I will try on Ubuntu using OpenOCD but I fear the same result will happen.