Skip to main content
Visitor II
June 20, 2023
Question

MKSBOX1V1 and SPBTLE-1S module

  • June 20, 2023
  • 5 replies
  • 2096 views

Hopefully someone can assist:

I am using the ST EVAL-MKSBOX1V1 (aka Sensortile Box) and trying to set up the SPBTLE-1S for use with STM32duino. I tried to follow the instructions in the STM32duino pages (here: https://github.com/stm32duino/Arduino_Core_STM32/wiki/STM32duinoBLE) and put a header on the board and hooked up a ST-Link JTAG programmer, and I can talk to the flash, however the links to both the DTM_LLOnly.bin and the DTM_Full.bin firmware files are both broken. I found the BlueNRG-1 dev kit however there are a lot of different DTM[misc].bin files available, and I also don't know what is currently flashed into the MKSBOX1V1 module however I'd like to be able to flash it back to "factory" if I play with re-flashing it. Thanks for anyone who can help or who has done this.

Glenn

    This topic has been closed for replies.

    5 replies

    Technical Moderator
    June 21, 2023

    Hi @GEmel.1 ,

    The steps to find the correct binary file are:

    • download STSW-BLUENRG1-DK 
    • use the DTM for STEVAL-IDB007V1M, that uses the same BLE chip as the sensortile.box

    If my reply answered your question, please click on Accept as Solution at the bottom of this post. This will help other users with the same issue to find the answer faster

    GEmel.1Author
    Visitor II
    June 21, 2023

    Which one? There are 6 here:

    Directory of ...\DTM\STEVAL-IDB007V1M

    143,904       DTM_SPI.bin
    149,504       DTM_SPI_NOUPDATER.bin
    143,900       DTM_UART.bin
    149,504       DTM_UART_NOUPDATER.bin
    143,904       DTM_UART_SLEEP.bin
    143,900       DTM_UART_Throughput.bin

    I did find the DTM_LLOnly.bin in the en.fp-ind-predmnt1.zip archive from ST, but when I flash that into the part the BLE.begin() call fails in the STM32duino environment (returns 0). And if I don't flash that, I can't seem to add any services - I only get these two no matter what I do:

    00001801-0000-1000-8000-00805f9b34fb (Handle: 1): Generic Attribute Profile
    00001800-0000-1000-8000-00805f9b34fb (Handle: 5): Generic Access Profile

    -Glenn

    GEmel.1Author
    Visitor II
    June 21, 2023

    So I am beginning to suspect that I really don't want the DTM_LLOnly.bin firmware in the SPTBLE-1S module, rather I want a full bluetooth stack, however the stack which comes with the sensortile box doesn't seem to support adding characteristics, at least as far as I can tell using the STM32duinoBLE support library. So perhaps there's a generic stack that will work... I'm still looking for help here.

    Glenn

    GEmel.1Author
    Visitor II
    June 22, 2023

    So if it helps, here is the entirety of the skeleton code that I've reduced this to, which still doesn't show anything but the two generic services I described above. I'm at a complete loss. If I put any firmware into the SPBTLE-1S module other than what is shipped with it, the BLE.begin() call fails. If I put the default firmware into the SPBTLE-1S module, then BLE gets initialized but the added custom services don't show up on any tools I use to inspect BLE devices (such as ST BLE Toolbox).

    #include <STM32duinoBLE.h>

    BLEService customService("0000FF00-0000-1000-8000-00805F9B34FB");  // Custom service UUID
    BLECharacteristic customCharacteristic("0000FF01-0000-1000-8000-00805F9B34FB", BLEWrite | BLERead, 32);  // Custom characteristic UUID

    SPIClass SpiHCI(PC3, PD3, PD1);
    HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_1S, PD0, PD4, PA8, 1000000, SPI_MODE1);

    BLELocalDevice BLEObj(&HCISpiTransport);
    BLELocalDevice& BLE = BLEObj;

    void setup() {
      Serial.begin(115200);

      while (!Serial);

      Serial.print("Starting BLE\n");

      // Initialize BLE
      if (!BLE.begin()) {
        Serial.print("BLE Init failed.\n");
        while(1);
      }

      // Set advertised local name and service UUID
      BLE.setLocalName("myRemoteDevice");
      BLE.setAdvertisedService(customService);
      BLE.addService(customService);

      // Add the characteristic to the service
      customService.addCharacteristic(customCharacteristic);

      // Start advertising
      BLE.advertise();

      Serial.print("Exiting Setup()\n");
    }

    void loop() {
      // Handle BLE events
      BLE.poll();

      // Check if data has been received
      if (customCharacteristic.written()) {
        Serial.print("Remote received data\n");
      }
    }
    GEmel.1Author
    Visitor II
    June 29, 2023

    Resolved here: https://github.com/stm32duino/STM32duinoBLE/issues/57

    The bottom line: The file DTM_LLOnly.bin contained in the fp-ind-predmnt1 archive does not apply to the SPBTLE-1S module mounted on the sensortile box. The above link to the solution references a custom version of DTM_LLOnly.bin built for use with the sensortile box under STM32duinoBLE.

    Many thanks to Carlo Parata (ST employee) for clarifying this and helping me out!