cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to program and debug BlueNRG-M2SA module

vrba.vojtech
Associate II

Hello, I would like to ask you for help with programming and debugging the BlueNRG-M2SA module.

I am just not able to get started and successfully connect to the module using ST-Link v2 over SWD. Neither using USB-UART chip (PL2303SA) to communicate with embedded bootloader.

I prepared this adaptor to DIP for the module to make it easier for breadboard tests:

0690X00000BvbEcQAJ.png

When I try to connect to the target using BlueNRG-1 ST-Link Utility, after checking that VIN, GND, SWDIO, SWDCLK and #RESETN pins are connected correctly, I get this error messages in the trace.log file:

cErrLog::SetLogTraceOn
STLinkUSBDriver.dll loaded
ST-Link/V2 device detected
Target voltage detected: 3.227749
Driving NRST low
Driving NRST high
Error getting target IDCODE: if SWD, check SWD connection
Error (4) while initializing ST-Link in SWD mode
ST-Link/V2 device detected
Target voltage detected: 3.235602
Driving NRST low
Driving NRST high
Error getting target IDCODE: if SWD, check SWD connection
Error (4) while initializing ST-Link in SWD mode
ST-Link/V2 device detected
Target voltage detected: 3.235602
Driving NRST low
Driving NRST high
W at 0xe000edf0: 0xa05f0003
R at 0xe000edf0: 0x03030003
R at 0xe000edf0: 0x00030003
Activating vector catch system
W at 0xe000edfc: 0x00000001
Sys reset req
W at 0xe000ed0c: 0x05fa0004
Error (0x12) after target cmd F2 35 0C ED 00 E0 04 00 FA 05
Error (0x12) after target cmd F2 36 F0 ED 00 E0 00 00 00 00
Driving NRST high
ST-Link/V2 device detected
Target voltage detected: 3.234031
Driving NRST low
Driving NRST high
Error getting target IDCODE: if SWD, check SWD connection
Error (4) while initializing ST-Link in SWD mode

Or sometimes I get this different error log messages:

cErrLog::SetLogTraceOn
STLinkUSBDriver.dll loaded
ST-Link/V2 device detected
Target voltage detected: 3.228777
Driving NRST low
Driving NRST high
Error getting target IDCODE: if SWD, check SWD connection
Error (4) while initializing ST-Link in SWD mode
ST-Link/V2 device detected
Target voltage detected: 3.230347
Driving NRST low
Driving NRST high
Error getting target IDCODE: if SWD, check SWD connection
Error (4) while initializing ST-Link in SWD mode
ST-Link/V2 device detected
Target voltage detected: 3.238195
Driving NRST low
Driving NRST high
W at 0xe000edf0: 0xa05f0003
R at 0xe000edf0: 0x03030003
R at 0xe000edf0: 0x00030003
Activating vector catch system
W at 0xe000edfc: 0x00000001
Sys reset req
W at 0xe000ed0c: 0x05fa0004
R at 0xe000ed0c: 0xfa050000
R at 0xe000edf0: 0x03030003
Driving NRST high
R at 0xe000edf0: 0x00030003
W regId 16: 0x01000000
W at 0xe000edfc: 0x00000000
Error (0x12) after target cmd F2 3E 00 00 00 00 00 00 00 00
Error (19) in ReadMemory_32Bit (4 bytes from 0xe000ed00)
Error (0x12) after target cmd F2 3E 00 00 00 00 00 00 00 00
Error (19) in ReadMemory_32Bit (4 bytes from 0xe000ed00)
Error (0x12) after target cmd F2 3E 00 00 00 00 00 00 00 00
Error (19) in ReadMemory_32Bit (4 bytes from 0xe000ed00)
Error (0x12) after target cmd F2 3E 00 00 00 00 00 00 00 00
Error (19) in ReadMemory_32Bit (4 bytes from 0xe000ed00)
Error (0x12) after target cmd F2 3E 00 00 00 00 00 00 00 00
Error (19) in ReadMemory_32Bit (4 bytes from 0xe000ed00)
R at 0xe000ed00: 0x00000000
R at 0xe000ed00: 0x00000000
R at 0xe000ed00: 0x00000000
R at 0xe000ed00: 0x00000000
R at 0xe000ed00: 0x00000000
R at 0xe000ed00: 0x00000000
W at 0xe000edf0: 0xa05f0000
Error (0x12) after target cmd F2 35 F0 ED 00 E0 00 00 5F A0

Similarly, using the BlueNRG-1_2 Flasher Utility, after connecting required power and UART pins and setting the BOOT pin high and trying to read flash memory, I get error messages in the log. Selected baudrate is 115200.

18:56:56.542: Device COM19 -> Read Board Started
18:56:57.719: Device COM19 -> Exit readBoard: Exception ID1: auto baudrate functionality failed

Sometimes reading seems to start and then stuck at about 5%, with error message that I should perform Mass erase, but checking that box doesn't help.

Thank you for help!

3 REPLIES 3
vrba.vojtech
Associate II

I managed to get ST-Link working. The problem was I was using cheap chinese USB ST-Link, which didn't communicate with the module for whatever reason. I tried embedded ST-Link in Nucleo-F303RE and STM32F4-Discovery kit, both are working.

But the bootloader over UART isn't working anyway.

HGonz.1
Associate

Hi,

I see in the BlueNRG-M2SA datasheet (DS13053) that the pin 21 has to be tied to GND, but the guidelines also recomend to place the antenna outside the main PCB, as you do in the development board X-NUCLEO-BNRG2A1 with the BLUENRG_M2SP. And I see that other products such as the SensiBLE 2.1 with the BlueNRG-M2SA module place it outside the PCB, leaving the pin 21 unconnected.

I am curious, did you solve the problem?

Thank you.

​Hello, I haven't got the bootloader working. The pin 21 is internally connected with GND and the metal shielding, so I guess it can be left unconnected.

So I use the ST-Link solution with BlueNRG-1 ST-Link Utility (because flashing directly from Keil uVision also doesn't work for me).