Arduino on Rak5010!

Thanks,

Can you please confirm that the VREF is the J12 EXT_VREF PIN defined in https://doc.rakwireless.com/datasheet/rakproducts/pin-definition ?

Would you recommend to connect the J10 VBAT to J12 EXT_VREF PIN to power the GPIO?

The buzzer needs full power to get 90db sound volume.

Yes, J10 VBAT to J12 EXT_VREF PIN is OK. But remember to connect your GND buzzer to GND of 5010.

Hi, I have a problem starting up the BG96 module. I think that the blue led should be always on, but the LED is blinking and the terminal is printing RDY as soon as the LED turns on. I think the module is rebooting.

Hi,
It is because of the power is not stable. If you just use usb for power, it maybe power up failly. So you’d better connect to a chargebale battery or keep usb voltage stable.

1 Like

Hi all.
Can you please tell me if the following procedure can be done?

  1. Get the last Adafruit feather_nrf52840_express_bootloader-0.3.2_s140_6.1.1.hex from https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/0.3.2/feather_nrf52840_express_bootloader-0.3.2_s140_6.1.1.hex

  2. Download it to the smartphone and burn it using BLE using “nRF Connect” as explained at:
    https://doc.rakwireless.com/rak5010-wistrio-nb-iot-tracker/upgrading-firmware-through-dfu-over-ble

  3. Use Arduino IDE to program the nRF as posted here.

Thanks

Hi,
DFU in step 2 is based on our RUI firmware. It can’t be mixed with Arduino because of two system. In fact, Arduino support DFU with Adafruit code and hex. If you want to do it, you can refer to the this. But remember, the board must have firmware support DFU. If empty, nothing can be done.

#include <Arduino.h>
#include <bluefruit.h>

// Forward declarations for functions
void connect_callback(uint16_t conn_handle);
void disconnect_callback(uint16_t conn_handle, uint8_t reason);

/**
@brief BLE DFU service
@note Used for DFU OTA upgrade
*/
BLEDfu bledfu;

/**
@brief Arduino setup function. Called once after power on or reset

*/
void setup()
{
// Initialize built in green LED
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);

// Initialize Serial for debug output
Serial.begin(115200);

// Wait for USB Serial to be ready or terminal to be connected
time_t timeout = millis(); // Timeout in case the system runs on its own
// Waiting for Serial
while (!Serial)
{
if ((millis() - timeout) < 5000)
{
// Blink the LED to show that we are alive
delay(100);
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}
else
{
// Timeout while waiting for USB Serial
break;
}
}

// Config the peripheral connection with maximum bandwidth
// more SRAM required by SoftDevice
// Note: All config***() function must be called before begin()
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);

Bluefruit.begin(1, 0);
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
Bluefruit.setTxPower(4);
// Set the BLE device name
Bluefruit.setName(“RAK4631_OTA”);

Bluefruit.Periph.setConnectCallback(connect_callback);
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);

// To be consistent OTA DFU should be added first if it exists
bledfu.begin();

// Set up and start advertising
// Advertising packet
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
Bluefruit.Advertising.addTxPower();
Bluefruit.Advertising.addName();

/* Start Advertising
- Enable auto advertising if disconnected
- Interval: fast mode = 20 ms, slow mode = 152.5 ms
- Timeout for fast mode is 30 seconds
- Start(timeout) with timeout = 0 will advertise forever (until connected)

 For recommended advertising interval
 https://developer.apple.com/library/content/qa/qa1931/_index.html

*/
Bluefruit.Advertising.restartOnDisconnect(true);
Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
Bluefruit.Advertising.start(0); // 0 = Don’t stop advertising after n seconds
}

/**
@brief Callback when client connects
@param conn_handle: Connection handle id
*/
void connect_callback(uint16_t conn_handle)
{
(void)conn_handle;
Serial.println(“BLE client connected”);
}

/**
@brief Callback invoked when a connection is dropped
@param conn_handle: connection handle id
@param reason: disconnect reason
*/
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
{
(void)conn_handle;
(void)reason;

Serial.println(“BLE client disconnected”);
}

/**
@brief Arduino loop. Runs forever until power off or reset

*/
void loop()
{
}

Thanks Nero!.

In fact, my target is to use Arduino IDE to make my own code and burn/upload it using the USB connection to the computer.
Is there a way to reach this, without using Jlink (as stablished on 8 of first post)?

I have a new rak5010.

No matter what IDE, the board must have the initial hex. Empty flash can do nothing. Jlink or DAP link is necessary.

So. With initial hex can I flash the arduino hex using BLE?
And then use USB for next hex?

Yes. You need a application and DFU file. You can refer to

Install it and refer to the bluefruit ble example. They provide the example of DFU.

Hi Nero.
I tried the procedure but aborted in the final step of flashing using DFU, because the confirmation popup asked for a *.dat file when trying to upload a hex file.

Let me try to clarify the situation.

I DO NOT have a Jlink programmer.

The rak5010 board is new, so it has the original .hex.

I want to burn the feather express bootloader as first step so in next steps I can program using serial port directly from Arduino IDE. (Is this correct?)

Sorry for the inconveniences. Not english speaker, and I don’t want to do something irreversible.
Can you (or anyone) detail how to?

Regards.
Ramiro

Hi,
The original hex is suitable for RUI. RUI is different from Arduino. Means you can’t OTA other bootloader or application to the board. Because it is cryptographic during OTA. One bootloader corresponding one application and one DFU zip. If you want to use other bootloader, you must use a programmer like Jlink or DAP-link. Or you can use our RUI compile system. It will supply the DFU zip, HEX. Our firmware can’t guarantee non-RUI hex or DFU.

So without jlink is imposible to burn arduino bootloader?

Right. DAP link works too.

OK. Any suggestion or steps to follow to use DAP link?
I really need to start programming in Arduino the nRF.
Thank you again @nero

For now, our DAP-LINK is not in store. The Jlink is best. Details as below:
https://doc.rakwireless.com/rak5010-wistrio-nb-iot-tracker/burning-the-firmware

I really don’t understand. You suggest me dap-link and then sent me to jlink. Really confused.

Also JTAG link in your store is broken…
https://store.rakwireless.com/products/emulator-kit

Our DAP-Link is not yet on the market. About next month. The guide will release together.

Hi @nero. Back again!
Finally I could flash the bootloader using a Raspberry PI and openocd.

Then, using Rak5010.rui from github, everything goes ok, compiling and flashing.

The problem I’m facing, is only receiving the:

****************************** Arduino on Rak5010 ******************************
bg96 power up!

message in serial terminal, and nothing else.
Could you tell me where to look?
Compiling with no errors, also when flashing. Following the steps as this post indicates.

Thanks again!
Ramiro

Hi,
Do you modify the example code? After it starts up, it will power bg96 and scan all sensors on the boards. It looks like you are stuck here. If bg96 starts ok, the blue led on and red blink. Is it ok on your board? If ok, next to check sensors. In the setup(), you can delete sensors init one by one to find which sensor is not ok. It is important to exclude hardware problems.