cancel
Showing results for 
Search instead for 
Did you mean: 

BLUENRG-M2SA kernel configuration linux

SParr.1
Associate II

Hello everyone. I am using the BLUENRG-M2SA with the processor SAMA5D27 Cortex-A5 in a linux system. I communicate with it by uart. I have set the kernel like the ubuntu site advises (https://ubuntu.com/core/docs/bluez/reference/device-enablement/linux-kernel-configuration-options). I set the pin boot to 0 and the pin reset to 1. I attach the device with hciattach /dev/ttyS* any (* is the number of my uart). My problem is when I try to do hciconfig dev i can see the device but the BD address is 02:80:E1:00:00:00, which is the same address i got in other BLUENRG-M2SA devices. When I try to do hcitool lescan i don't see any device on the list. Also when i run the command service bluetooth status i notice that rfkill isn't available. Have you got some suggestion for the kernel configuration or do i miss some commands? 

Thank you  

Regards

5 REPLIES 5
Winfred LU
ST Employee

In the kernel configuration options, make sure "Bluetooth Low Energy (LE) features" is selected. But, configuration doesn't seem to be the issue.

Please try to compile DTM project with defining LL_ONLY in preprocessor, and re-flash with the newly built firmware.

SParr.1
Associate II

Dear Winfred,

thanks for your support. Regarding the "Bluetooth Low Energy (LE) feature" it was indeed selected in the kernel.

As for the compilation of the DTM project could you please share some instructions? Do I need a IDE (Keil and MuVision)? Where can I find the files to be compiled?

Moreover, I have to specify that I'm using a custom board (the one with the SAMA5D27) and I would like to to communicate with the BlueNRG-2 through UART interface when executing my own BLE applications. I have not and I cannot use any intermediate ST board like NUCLEO or STEVAL) to flash or use the BLUENRG-2. By reading some documentation, it seems then to me that I have to configure the bluetooth module in "network coprocessor" mode. Therefore, I assume that I need to flash inside the module (which has nothing inside, I believe) the DTM FW files placed inside the ST-DK folders.

By using the BlueNRG-X Flasher Utility (through a JTAG-connection in SWD mode) I can flash the DTM_UART files, but when rebooting and accessing the module through hcitool commands, I can only see this address: 02:80:E1:00:00:00. This address can be maybe good for the first part (02:80:E1), but not for the second (00:00:00). Executing hcitools commands does not result in any discoverable device for an external smartphone with bluetooth on and therefore I cannot pair to my board...

Do you have any suggestions on this?

Thanks for your support,

Stefano

Winfred LU
ST Employee

You will need some IDE to build the DTM project. The supported IDEs : EWARM, MDK-ARM, TrueStudio, WiSE-Studio.

The sample projects can be found in BlueNRG-1/2 DK, after installed.

https://www.st.com/content/st_com/en/products/embedded-software/evaluation-tool-software/stsw-bluenrg1-dk.html

DTM is exactly what is needed to make BlueNRG-2 as a network coprocessor.

Select the UART configuration to compile.

https://www.st.com/resource/en/design_tip/dm00547290-how-to-configure-the-bluenrg1-and-bluenrg2-devices-in-network-coprocessor-mode-stmicroelectronics.pdf

The address can be set by aci_hal_write_config_data(), giving offset equal to 0.

SParr.1
Associate II

Hi Winfred,

I've tried with TrueStudio, opened the project and compiled the DTM with LL_ONLY define option you advised for. After including the right dependencies, I've managed to flash the firmware through the JTAG cable and the ST Flasher Utility Tools and make the BLUENRG-2 a network coprocessor. I've been seeing that also the address 02:08:E1:00:00:00 was strange to me but correct and configurable from source, as you said.

After flashing this FW, I was able to scan the BLE devices around the BLUENRG-2 and it worked (it was detecting for example a smartwatch, resolving also the name). After this step, how can I pair the two devices? Can I do it preliminarly through hcitool commands? In general, I assume I have to write my own software to be installed inside my custom board and communicate through UART from and to the BLUENRG module. If so, can you please indicate to me some resources?

I've also read that I could've used STM32CubeProg IDE to flash the firmware. This software could also flash a firmware through pure UART protocol, is that right? In that case, there is a way to install the STM32CubeProg IDE inside my custom board (which has not GUI at all) and use it from command line (In this way I think I could not use any cable at all)?

Best regards,

Stefano

Winfred LU
ST Employee

Glad to see it works for you.

Please try the btmgmt tool in BlueZ to help pair.

To write your own software, you might be interested in BlueZ source code and have a look at main.c in client folder.

https://github.com/bluez/bluez/tree/master/client