Skip to main content
gada
Associate III
May 16, 2024
Question

Cannot build a working DTM_SPI BLE Firmware for BlueNRG-M2SA

  • May 16, 2024
  • 8 replies
  • 3113 views

A BLE Project for developed on steval-mksbox1v1 which had SPBTLE-1s.
Since it became NRND we switched to BlueNRG-M2SA Module which has same footprint.
Using the BlueNRG-1_2 DK 3.2.3 I have tried to get build the project with following pin changes as per mksbox connections - in hw_config.h

#define SPI_CS_PIN GPIO_Pin_1
#define SPI_OUT_PIN GPIO_Pin_2
#define SPI_IN_PIN GPIO_Pin_3
#define SPI_CLCK_PIN GPIO_Pin_0

 

But to my despair the in the built project binaries flashed into the module, the IRQ pin never becomes high in this firmware and the HCI code does not progress as IRQ low. In short the module does not initialize.

I have used projects from following paths.

BlueNRG-1_2 DK 3.2.3\Project\BLE_Examples\DTM\MDK-ARM\STEVAL-IDB008V1M

BlueNRG-1_2 DK 3.2.3\Project\BLE_Examples\DTM\MDK-ARM\STEVAL-IDB007V1M

After nothing of above worked, we had previous removed the ble firmware from the mksbox ble module and this particular firmware works fine on both the SPBTLE-1S and BlueNRG-M2SA with a issue that in M2SA Sleep currents are 5mA which is very high and thus we want correct firmware to be loaded in M2SA module to get lower currents.

We want the correct firmware DTMSPI for M2SA Module for Connections that are same of MKSBOX Board. Please help.

 

Regards

8 replies

Laurent LOUAZON
ST Employee
May 17, 2024

Hello,

 

Please note DTM SPI FW for BlueNRg-M2 is already provided in BlueNRG-1_2 DK 3.2.3.

 

You will also find in this SDK documentation, the recommended mammping for SPI and IRQ (corresponding to this FW).

I then recommend this SPI mapping and the provided DTM SPI FW.

LaurentLOUAZON_0-1715958005932.png

 

 

Regards

Laurent

gada
gadaAuthor
Associate III
May 20, 2024

Hi Laurent,

If you check steval-mksbox1v1 sensortile board schematic, in that board the pins are not same as the firmware binary or source code provided in BlueNRG-1_2 DK 3.2.3.

Our board was made on that basis thus my pins are as following -

#define SPI_CS_PIN GPIO_Pin_1
#define SPI_OUT_PIN GPIO_Pin_2
#define SPI_IN_PIN GPIO_Pin_3
#define SPI_CLCK_PIN GPIO_Pin_0
#define GPIO_MODE_SPI Serial0_Mode

#define SPI_IRQ_PIN GPIO_Pin_14

 

Regards

 

 

 

Laurent LOUAZON
ST Employee
May 22, 2024

Hello,

Ok but the point is that  if you refer BlueNRG-2 datsheet (BlueNRg-2 is the SoC included inside BlueNRG-M2 module), you will see SPI CS can be set using aither DIO1 or DIO11 (see bluenrg-2 datsheet table 130)

But DIO1 is not a wake up capble IO (see BlueNRG datasheet chapter 3.4.1.3)

So if you use a DTM SPI FW inside BlueNRG-2 that is having sleep mode enabled, DIO1 will not be able to wake up BlueNRG-2/BlueNRg-M2

 

So either you use DIO11 pin as CS pin and you can use a DTM SPI FW with sleep mode, either you need to disable sleep mode in DTM SPI FW if you want to use DIO1.

 

Regards

Laurent

gada
gadaAuthor
Associate III
May 22, 2024

Hi,

 

I very well get your this point. Due to this concern what I did is I keep DIO1 as the chip select but I also operate DIO11 from another GPIO(USAR2_BLE_RX_UC_TX) along with the CS function to wakeup and sleep the BlueNRG Chip.

gada_0-1716372582515.png

The question though is not about sleep majorly but basic SPI Communication with the BLE IC.

I have noticed the BLE SPI INT Pin does not go high and due to which other codes SPI Write gets stuck waiting for it.

Regards

Kashyap

Laurent LOUAZON
ST Employee
May 22, 2024

Hello,

 

OK clear now.

which DTM SPI project have you used with BlueNRG-1_2 DK 3.2.3\Project\BLE_Examples\DTM\MDK-ARM\STEVAL-IDB008V1M?
Do you have same issue if you select "SPI" or "SPI no updater"?

 

Regards

gada
gadaAuthor
Associate III
May 23, 2024

Yes, Both projects have same issue.

Laurent LOUAZON
ST Employee
May 23, 2024

Hello,

 

Can you try below :
- Do a full mass erase
- Flash the DTM SPI no updater version you will have rebuilt but having set MEMORY_FLASH_APP_OFFSET=0x0 instead of 0x2000 in the linker option

Regards
Laurent

 

gada
gadaAuthor
Associate III
May 23, 2024

In SPI no updated version

Kept preprocessor values as follows

SPI_INTERFACE WATCHDOG WATCHDOG_TIME=1 BLE_STACK_CONFIGURATION=BLE_STACK_FULL_CONFIGURATION BLUENRG2_DEVICE HS_SPEED_XTAL=HS_SPEED_XTAL_32MHZ USER_BUTTON=BUTTON_2 LS_SOURCE=LS_SOURCE_INTERNAL_RO SMPS_INDUCTOR=SMPS_INDUCTOR_NONE

and Linker as --predefine="-DMEMORY_FLASH_APP_OFFSET=0 "

 

BLE init failed. Same code with original firmware

Laurent LOUAZON
ST Employee
May 23, 2024

Hello,

 

On BlueNRG-M2SA, 32kHz is used and SMPS is implemented so you must defined

LS_SOURCE=LS_SOURCE_EXTERNAL_32KHZ

SMPS_INDUCTOR=SMPS_INDUCTOR_10uH

See DT037 documentation.

 

Laurent

gada
gadaAuthor
Associate III
May 23, 2024

Hi,

 

Done the above changes. Results unchanged. No IRQ on BLE_INT Pin.

Laurent LOUAZON
ST Employee
May 23, 2024

Hi,

 

No more idea on my side.
May be could you confirm using DIO7 as IRQ as our default example, you can see IRQ rising up (you can add wire to modify your PCB)?

 

Laurent

gada
gadaAuthor
Associate III
May 23, 2024

As you can see we are using DIO14

 

gada_0-1716465972294.png

 

Laurent LOUAZON
ST Employee
May 23, 2024

Yes I see.

My request is maybe to rebuild FW with DIO7 as IRQ and modify your PCB as a test.

DIO7 is the default IRQ used in our example.

This is to see if this is related to DIO14 and any specifc thing around it.

 

Laurent 

gada
gadaAuthor
Associate III
May 23, 2024

In mksbox sensor tile DIO14 is used.

Could you, if possible, share the original firmware source code of DTM_Spi used in sensortile board?

That is not available online. I want to check the project because that firmware works fine on my board. its the new firmware i create which are not working.