This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Programming MDBT42-Q (nRF52832) to use BLE

Hi everyone, I have been using for a while the Adafruit nRF52 Feather board, programming BLE related apps using the Arduino IDE using the Bluefruit library for BLE. 

I wanted to implement the same kind of solutions in a custom board, using the same module on the Feather, the MDBT42-Q which embed the nRF52832. 

I am using a Nordic nrf52 DK to upload the code and using SWD programming I have been able to upload a blink app to the module, using the Arduino IDE, uploading soft device and Bootloader (I tried both the latest version downloadable on the Nordic website and the one provided by Adafruit) using the Nordic nrfgo Studio to do so. When I try to upload any BLE related app I am not able to upload the code. I have been trying both using the Arduino IDE and the Nordic platform, I wanted to ask you if anyone has managed to program BLE apps using Arduino language (Arduino IDE or platformio), and in case with which library, or if the only solution is using the Nordic SDK or if there is any solution at all.

Thank you in advance to all of you. Best Slight smile

~Gu

Parents
  • Hello Gu,

    I don't think you can use Arduino IDE on our chips by default. If you want to know how it works, you will have to ask Arduino, as far as I know. 

    What files did you try to upload using nRFgo Studio?

    I believe that when you program the Feather board using the Arduino IDE, it uses a custom bootloader, which we don't have access to. 

  • Hi Edvin, I imagined this could have been the problem. But if I upload the code:

    void setup() {
      Serial.begin(115200);
      pinMode(19, OUTPUT); // Led 
    }
    
    void loop() {
      digitalWrite(19, HIGH);   
      delay(100);                       
      digitalWrite(19, LOW);   
      delay(100);                       
    }

    Using the Arduino IDE I can actually see the led blinking, but if I try to use the library BLEPeripheral it doesn't work, i.e. 

    #include <Arduino.h>
    #include <SPI.h>
    #include <BLEPeripheral.h>
    
    BLEPeripheral ledPeripheral = BLEPeripheral();
    
    BLEService ledService = BLEService("19b10000e8f2537e4f6cd104768a1214");
    BLECharCharacteristic ledCharacteristic = BLECharCharacteristic("19b10001e8f2537e4f6cd104768a1214", BLERead | BLEWrite);
    
    void setup()
    {
      pinMode(19, OUTPUT);
      digitalWrite(19, LOW);
      ledPeripheral.setAdvertisedServiceUuid(ledService.uuid());
      ledPeripheral.addAttribute(ledService);
      ledPeripheral.addAttribute(ledCharacteristic);
      ledPeripheral.setLocalName("Nordic NRF52 DK");
      ledPeripheral.begin();
    }
    
    void loop()
    {
      digitalWrite(19, HIGH);
      BLECentral central = ledPeripheral.central();
      

    BTW Bootloader and soft device are installed on the module through the nRF52 DK. What would you suggest if this is not actually supported to program the module to read and write on characteristic using BLE? 

    Thank you in advance Edvin. Best, 

    Gu

  • I don't know if the bootloader that the Arduino IDE uses is the same that is found in our SDK. What bootloader did you upload by the way? The bootloaders (at least from the SDK versions the last 2-3 years) are signed bootloaders, meaning they will only accept DFU files that are signed with the correct key. I don't know, but I suspect that the Arduino IDE has it's own private keys, if they at all use the bootloader from our SDK. 

     

    googx said:
    but if I try to use the library BLEPeripheral it doesn't work, i.e. 

     Can you please describe what you mean by "doesn't work"? When you compile it, what sort of file do you get? An ".ino" file? And how do you program that to the custom board? Through the Arduino IDE?

    To be honest, I think it will be difficult to program an application written in the adruino language to a non-arduino compatible board. If so, you will need to ask Arduino (the people providing the IDE) how they upload the files to their boards. I don't think they have a debugger on board, so I believe they use some kind of bootloader, but which one, I don't know. 

    Best regards,

    Edvin

Reply
  • I don't know if the bootloader that the Arduino IDE uses is the same that is found in our SDK. What bootloader did you upload by the way? The bootloaders (at least from the SDK versions the last 2-3 years) are signed bootloaders, meaning they will only accept DFU files that are signed with the correct key. I don't know, but I suspect that the Arduino IDE has it's own private keys, if they at all use the bootloader from our SDK. 

     

    googx said:
    but if I try to use the library BLEPeripheral it doesn't work, i.e. 

     Can you please describe what you mean by "doesn't work"? When you compile it, what sort of file do you get? An ".ino" file? And how do you program that to the custom board? Through the Arduino IDE?

    To be honest, I think it will be difficult to program an application written in the adruino language to a non-arduino compatible board. If so, you will need to ask Arduino (the people providing the IDE) how they upload the files to their boards. I don't think they have a debugger on board, so I believe they use some kind of bootloader, but which one, I don't know. 

    Best regards,

    Edvin

Children
Related