RAK4630 Flash Chip

I would like to integrate the RAK4630 module into a design I’m working on. I’ve used the RAK4631 module on the Wizblock with an IO breakout for proof-of-concept and a sort of alpha stage prototype. I’m ready for the next stage, and would like to use just the RAK4630 (and minimum support components) to keep the physical size to a minimum. Looking at the reference design I found for RAK4631 I’m not seeing much specific information about the SPI Flash chip. The schematic seems to indicate the physical form factor, but nothing about the model or functionality of the flash chip.

What is the recommended flash chip, or what should I look for when selecting one?

Then my next question is how do I load the Arduino bootloader?

Welcome to RAK forum @mt37 ,

There is no external flash chip on RAK4630. Its chips are SX1262 (LoRa transceiver) and nRF52840 (MCU with BLE). Here’s the schematic.

Some history about the flash chip (that is not assembled on the RAK4631).

It was planned to use it, but we found no real need for it, so to reduce cost and power consumption, we never assembled it.

Okay, so to use the RAK4630 stamp module, there is no external flash chip required. Nice.

So now, if I build a PCB with the RAK4630 stamp module, can I just hook up the power (3.3v regulator with decoupling caps) and USB and start uploading code to it directly from Arduino IDE, just like I’m doing with the RAK4631 on the Wizblock? Or do I need to load the arduino bootloader onto the RAK4630 first, and if so, how?

Hi Matthew,

Please check the power paths of our RAK10702, where the RAK4630 runs from a single 3.3V supply:

If you buy RAK4630 stamp module, it comes (different to the WisBlock Core modules) with the RUI3 bootloader and AT command firmware. You can build your application with the RUI3 BSP and RUI3 API or you can change the bootloader to the Arduino BSP version (which we use on the RAK10702 as well).

Changing bootloader can be done over USB, as explained in our Documentation Center

Or you can use a JLink or DAPLink programmer, like our RAKDAP1. A guide is in this Tutorial

Keep in mind to make the SWD/JLink interface accessible on a pin header, this makes it easy to upgrade firmware or to debug firmware:
image

Thank you for your input. I just assembled my first prototype PCB using the RAK4630 stamp module (soldered directly to my PCB), and I connected it to my windows computer using USB. I can use a terminal connected to the COM port (in this case it’s COM8) to send AT+VER=? and it responds to the AT command with AT+VER=RUI_4.0.5_RAK4631

I started following the instructions to install the Arduino BSP (“Converting RAK4631-R to RAK4631”), but it’s failing at this command:

nrfutil.exe dfu serial -pkg rak4631_factory_bootloader.zip -p COM8

It sits at 0% for about 35 seconds before failing with this error:

C:\RAK4631 Bootloader to RUI v3>nrfutil.exe dfu serial -pkg rak4631_factory_bootloader.zip -p COM8
  [------------------------------------]    0%
Traceback (most recent call last):
  File "nordicsemi\__main__.py", line 1555, in <module>
  File "click\core.py", line 1137, in __call__
  File "click\core.py", line 1062, in main
  File "click\core.py", line 1668, in invoke
  File "click\core.py", line 1668, in invoke
  File "click\core.py", line 1404, in invoke
  File "click\core.py", line 763, in invoke
  File "nordicsemi\__main__.py", line 1073, in serial
  File "nordicsemi\__main__.py", line 988, in do_serial
  File "nordicsemi\dfu\dfu.py", line 123, in dfu_send_images
  File "nordicsemi\dfu\dfu.py", line 88, in _dfu_send_image
  File "nordicsemi\dfu\dfu_transport_serial.py", line 214, in open
pc_ble_driver_py.exceptions.NordicSemiException: No ping response after opening COM port
[45236] Failed to execute script '__main__' due to unhandled exception!

How do I proceed?

I was able to update the firmware after changing my “lf” and “cr” terminator setting in the terminal so the AT+BOOT command worked correctly and the firmware updated successfully (I think).

The LED connected to P1.03 (LED1) is slowing fading in and out. Also, it now shows up as a storage device in windows, in addition to a virtual COM port (now COM9).

Now I’m having trouble uploading my program. It compiles okay in PlatformIO but it fails to upload with this error:

Waiting for the new upload port...
Uploading .pio\build\wiscore_rak4631\firmware.zip
Upgrading target on COM9 with DFU package C:\Users\Matt\Dropbox\tech\PlatformIO\GSB_RAK\.pio\build\wiscore_rak4631\firmware.zip. Flow control is disabled, Single bank, Touch disabled

Failed to upgrade target. Error is: ClearCommError failed (PermissionError(13, 'The device does not recognize the command.', None, 22))
Traceback (most recent call last):
  File "C:\Users\Matt\.platformio\packages\tool-adafruit-nrfutil\site-packages\nordicsemi\__main__.py", line 296, in serial
    dfu.dfu_send_images()
  File "C:\Users\Matt\.platformio\packages\tool-adafruit-nrfutil\site-packages\nordicsemi\dfu\dfu.py", line 235, in dfu_send_images
    self._dfu_send_image(HexType.APPLICATION, self.manifest.application)
  File "C:\Users\Matt\.platformio\packages\tool-adafruit-nrfutil\site-packages\nordicsemi\dfu\dfu.py", line 203, in _dfu_send_image
    self.dfu_transport.send_init_packet(init_packet)
  File "C:\Users\Matt\.platformio\packages\tool-adafruit-nrfutil\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 155, in send_init_packet
    self.send_packet(packet)
  File "C:\Users\Matt\.platformio\packages\tool-adafruit-nrfutil\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 243, in send_packet
    ack = self.get_ack_nr()
  File "C:\Users\Matt\.platformio\packages\tool-adafruit-nrfutil\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 264, in get_ack_nr
    temp = [x for x in self.serial_port.read(6)]
  File "C:\Users\Matt\.platformio\packages\tool-adafruit-nrfutil\site-packages\serial\serialwin32.py", line 275, in read
    raise SerialException("ClearCommError failed ({!r})".format(ctypes.WinError()))
serial.serialutil.SerialException: ClearCommError failed (PermissionError(13, 'The device does not recognize the command.', None, 22))

Possible causes:
- Selected Bootloader version does not match the one on Bluefruit device.
    Please upgrade the Bootloader or select correct version in Tools->Bootloader.
- Baud rate must be 115200, Flow control must be off.
- Target is not in DFU mode. Ground DFU pin and RESET and release both to enter DFU mode.

Any suggestions?

While the device is in UF2 mode (external disk showing up), flash the .UF2 file from the attached ZIP file.
Sometimes flashing the bootloader alone doesn’t work.
wiscore_rak4631_board_bootloader-0.4.3_s140_6.1.1.uf2.zip (24.8 KB)

Unzip the ZIP file, and drag the wiscore_rak4631_board_bootloader-0.4.3_s140_6.1.1.uf2 file to the RAK4631 drive.

Then try again to flash your firmware.

I dragged over the .uf2 file, and I’m still getting the same error when I try to upload my code.

I’m not sure what you mean by “flash your firmware” so I tried running

nrfutil.exe dfu serial -pkg rak4631_factory_bootloader.zip -p COM9

again (now COM9 not COM8), and I’m getting this error:

C:\RAK4631 Bootloader to RUI v3>nrfutil.exe dfu serial -pkg rak4631_factory_bootloader.zip -p COM9
  [------------------------------------]    0%2024-01-02 12:18:32,401 No trigger interface found for device with serial number: 23E0C5E6F7B04A19, Product ID: 0x0029 and Vendor ID: 0x239A


Traceback (most recent call last):
  File "nordicsemi\__main__.py", line 1555, in <module>
  File "click\core.py", line 1137, in __call__
  File "click\core.py", line 1062, in main
  File "click\core.py", line 1668, in invoke
  File "click\core.py", line 1668, in invoke
  File "click\core.py", line 1404, in invoke
  File "click\core.py", line 763, in invoke
  File "nordicsemi\__main__.py", line 1073, in serial
  File "nordicsemi\__main__.py", line 988, in do_serial
  File "nordicsemi\dfu\dfu.py", line 123, in dfu_send_images
  File "nordicsemi\dfu\dfu.py", line 88, in _dfu_send_image
  File "nordicsemi\dfu\dfu_transport_serial.py", line 214, in open
pc_ble_driver_py.exceptions.NordicSemiException: No ping response after opening COM port
[50460] Failed to execute script '__main__' due to unhandled exception!

It’s not responding to AT commands (probably since it supposedly has the Arduino bootloader now), so I don’t think AT+BOOT will do anything (it doesn’t seem to make a difference).

Right now things are mixed up.
With the Arduino bootloader, the upload tool is adafruit-nrfutil.exe and not nrfutil.exe.

Did you install the Arduino BSP for the RAK4631 in ArduinoIDE? There are two BSP, one for the Arduino version and one for RUI3. You have to use the one for Arduino.

Did you try to flash an application from ArduinoIDE after you updated the bootloader (the .UF2 file)?

When compiling and flashing from ArduinoIDE, make sure to select the correct board.

Yes I had previously installed the Arduino BSP for the RAK4631 in ArduinoIDE. I did the one “For Arduino bootloader” as seen here:

After updating the bootloader (copying over the .UF2 file you shared with me), I just tried flashing from ArduinoIDE and I get a very similar response (as in PlatformIO), as seen here:

I don’t think there is a problem with the device.
This message:


Points to a problem with access rights (Permission Error) to the serial port.

Any other application open that might block the USB’s?
I had a weird experience with the Ultimaker Cura application (for 3D printing) which was occupying all USB ports while running (to check if there are any 3D printers attached).

Can you try to flash the attached application the same way you flashed the bootloader? This application is the base for all my code I am writing.

Double push reset, drag the UF2 file to the new drive
It should give you some log output over the USB (115200 baud, 8N1):

10:48:26.051 --> [APP] Setup application
10:48:56.146 --> [APP] Initialize application

And you can try to send AT? (with \r\n line ending) and it should response with a list of available AT commands.

WisBlock_LowPower_V1.0.0_2024.01.04.10.47.29.uf2.zip (149.2 KB)

@mt37 just had the same question about flash chip, may be it can be used to OTA flash I don’t know yet what we will do with this one.

We are building some custom boards samples and we are populating our board with W25Q128JVPIQ LCSC #C190862 powered by MOSFET and external IO to consume 0 when not using it.

Take care selecting SPI flash, some are not supporting more than 2V and may need level shifters.

We wired this SPI Flash same way as on schematics of RAK4631, we’ll see.

I double-pressed reset so the LED was fading on and off, opened a terminal with the USB virtual COM port to see if there was any communication, and dragged over this .uf2 file you just shared.

After copying over, the LED went off completely, it no longer shows up as a USB COM port, and it no longer shows up as a flash drive. I can double-press reset to get back into the previous state, where the LED is pulsing slowly and it shows up as a flash drive.

At no point did I see anything print to the terminal, and as soon as the file finished transferring, the COM port disappeared and the terminal went into error state (since there was no longer a COM port to be connected to). Since there’s no COM port unless it’s in the mode after double-pressing reset, there’s no chance to try AT?

I don’t think there is anything running that would interfere with the COM port. When I use the WisBlock with the RAK4631 I’m able to upload code from Arduino like before.

Okay, I think I got it working now. In Arduino IDE I selected Programmer: "Bootloader DFU for Bluefruit nRF52" and then I clicked "Burn Bootloader".
image

At first it was complaining about a directory issue, so I copied C:\Users\Matt\AppData\Local\Arduino15\packages\rakwireless\hardware\nrf52\1.3.3\bootloader\WisCore_RAK4631_Board\WisCore_RAK4631_Board_bootloader.zip and renamed the copy WisCore_RAK4631_Board_bootloader-0.6.2_s140_6.1.1.zip (same directory), and then it proceeded with this:

Now I can upload a blink sketch successfully:

So yay! I think it’s all good for now. Thanks for your help.

I would suggest adding the whole part about selecting the programming and “burn bootloader” to the official instructions here. Also I would suggest fixing the path error so you don’t have to manually rename WisCore_RAK4631_Board_bootloader.zip to WisCore_RAK4631_Board_bootloader-0.6.2_s140_6.1.1.zip (or create a copy with the name the “Burn Bootloader” is looking for).