Unable to upload demo code with Arduino IDE

Hi

So I have a RAK3172 evaluation board and I try to play basic first by uploading on it the demo LED flashing code as suggested by Rak wiki. I can compile the demo code without problem in Arduino IDE (after having added boards and libs definition as documented by RAK). Unhappy when I want to upload in board it fails on a serial error !
Arduino IDE is seeing well the USB port of the board but it doesn’t want to communicate.
I use Arduino IDE 1.8.13 on Debian 11 I have already flashed quite few different boards previously with Arduino IDE without problems.
If I use the serial monitor in Arduino IDE, no problem to send AT commands and get answer from board (board is running RUI 3.4.11).
Here are last lines of compilation/attempt to upload on board:

> Archiving built core (caching) in: /tmp/arduino_cache_112174/core/core_rak_rui_stm32_WisDuoRAK3172EvaluationBoard_debug_l1_ae312caaf0b76e4dcf37f49b507c4814.a
> Linking everything together...
> "/home/vincen/.arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/arm-none-eabi-gcc" "-L/tmp/arduino_build_36589" -Os -Wl,--gc-sections -save-temps  "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/core/soc/stm32wle5xx" "-Tflash_stm32wle5xx.ld" "-Wl,-Map,/tmp/arduino_build_36589/Arduino_Led_Breathing.ino.map" -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -u _printf_float -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common --specs=nano.specs --specs=nosys.specs "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/app" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/core/mcu/stm32wle5xx" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/core/mcu/stm32wle5xx/uhal" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/external" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/core/board/rak3172" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/serial" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/flash" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/timer" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/service/nvm" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/system" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/powersave" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/wdt" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/gpio" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/twimst" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/delay" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/rtc" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/service/lora" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/delay" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/gpio" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/rtc" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/twimst" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/dfu" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/pwm" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/adc" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/pdm" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/udrv/spimst" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/service/battery" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/service/mode" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/service/debug" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/rui_v3_api" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/fund/event_queue" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/cores/STM32WLE/component/fund/circular_queue" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/variants/WisDuo_RAK3172_Evaluation_Board" "-L/home/vincen/.arduino15/packages/rak_rui/hardware/stm32/3.5.3/system/WisDuo_RAK3172_Evaluation_Board" -o "/tmp/arduino_build_36589/Arduino_Led_Breathing.ino.elf" "/tmp/arduino_build_36589/sketch/Arduino_Led_Breathing.ino.cpp.o" "/tmp/arduino_build_36589/core/PeripheralPins.c.o" "/tmp/arduino_build_36589/core/PortNames.c.o" "/tmp/arduino_build_36589/core/board.c.o" "/tmp/arduino_build_36589/core/board_basic.c.o" "/tmp/arduino_build_36589/core/delay-board.c.o" "/tmp/arduino_build_36589/core/pinmap.c.o" "/tmp/arduino_build_36589/core/radio_board_if.c.o" "/tmp/arduino_build_36589/core/rtc-board.c.o" "/tmp/arduino_build_36589/core/rui_inner_main.c.o" "/tmp/arduino_build_36589/core/subghz.c.o" "/tmp/arduino_build_36589/core/timer_if.c.o" "/tmp/arduino_build_36589/core/version.c.o" "/tmp/arduino_build_36589/core/variant.cpp.o"  -Wl,--start-group -lc -lm -lnosys -lstdc++ "/tmp/arduino_build_36589/core/core.a" -ludrv_serial -ludrv_flash -ludrv_timer -ludrv_system -ludrv_powersave -ludrv_wdt -ludrv_gpio -ludrv_twimst -ludrv_delay -ludrv_rtc -ludrv_delay -ludrv_gpio -ludrv_rtc -ludrv_twimst -ludrv_dfu -ludrv_pwm -ludrv_adc -ludrv_pdm -ludrv_spimst -lrui_v3_api -Wl,--end-group
> "/home/vincen/.arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/arm-none-eabi-objcopy" -O binary -S  "/tmp/arduino_build_36589/Arduino_Led_Breathing.ino.elf" "/tmp/arduino_build_36589/Arduino_Led_Breathing.ino.bin"
> "/home/vincen/.arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/arm-none-eabi-objcopy" -O ihex  "/tmp/arduino_build_36589/Arduino_Led_Breathing.ino.elf" "/tmp/arduino_build_36589/Arduino_Led_Breathing.ino.hex"
> Le croquis utilise 165648 octets (82%) de l'espace de stockage de programmes. Le maximum est de 200704 octets.
> Les variables globales utilisent 28584 octets (58%) de mémoire dynamique, ce qui laisse 20056 octets pour les variables locales. Le maximum est de 48640 octets.
> Redémarrage forcé en cours en 1200bps ouvert/fermé sur le port /dev/ttyUSB0
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> PORTS {/dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
> Uploading using selected port: /dev/ttyUSB0
> /home/vincen/.arduino15/packages/rak_rui/tools/uploader_ymodem/1.0.0/uploader_ymodem.py -f /tmp/arduino_build_36589/Arduino_Led_Breathing.ino.bin -p /dev/ttyUSB0 
> Traceback (most recent call last):
>   File "/home/vincen/.arduino15/packages/rak_rui/tools/uploader_ymodem/1.0.0/uploader_ymodem.py", line 6, in <module>
>     import serial
> ModuleNotFoundError: No module named 'serial'
> ModuleNotFoundError: No module named 'serial'

Side question: does it need to get proper code loaded in board to get charging circuit to work ? ir does it work whatever code loaded in board ?

Thanks

Vincèn

Can you try to force the RAK3172 into bootloader mode by sending AT+BOOT through the Arduino Terminal first and then try to upload the code?

For the charging circuit, it is independent of the firmware in the RAK3172, it should charge at any time.

Once sent the AT command module answers with BOOT MODE so I guess it’s all good but same symptoms for upload of program !
2 questions:

  • is it ok to get the J-Link programmer option active in Arduino ? I can’t deactivate it by clicking on it :frowning: It’s in Tools menu of Arduino IDE
  • is it normal that it indicates in compiling window just before transfering binary into board that it switches at 1200 bauds ??

Redémarrage forcé en cours en 1200bps ouvert/fermé sur le port /dev/ttyUSB0

Thanks for clarification :+1:

Not sure if it can help but I tried the RAK3172 evaluation board with Wistoolbox for desktop.
At first it didn’t recognise the module as it was still in boot mode so I issue a AT+RUN on it and now Wistoolbox detects instantly the module and then does an error stating it can’t connect to it :frowning: although if I use Wistoolbox terminal I can send command at module…

As far as I know the Programmer option J-Link is only for flashing the bootloader, not for uploading code. I never used it by myself.

The switch to 1200 baud is to force the module into bootloader mode and is normal.

Do you have the latest WisToolBox version? Older WisToolBox versions do not support newer RUI3 versions.

I am a little bit lost at the moment. I do not have a Linux system and I don’t have any problems to flash my RAK3172 EVB’s from Arduino. Do you have access to a Windows computer to try it from there?

succeeded to deactivate the option by editing a config file of Arduino IDE :slight_smile:

Yep downloaded from your website or snap website :wink:

Nope only using real OS here :smiley: I have a separate thread for Wistoolbox issues here: WisToolbox freezing on white screen on Debian 11 ! - #3 by vincen

Side note: who should I contact to get that article updated on your website ? Make Sure Your Environment is Healthy with Helium, RAKwireless and RUI3 The github link in it is dead as repository indicated has been deleted from github :frowning:

For the article, I checked the Github link to the sources and it is working RUI3-RAK12047-Air-Quality

For the other Linux based problems, I don’t know what’s wrong and right now we have no one in the team who uses Linux.

Sorry but that link is not working !! I have a 404 from Github whatever I’m logged or not on their website ! Can you try to access it without being logged on github ? I suspect that repo is private or something like that !

Confused by your answer because then how is it possible that Wistoolbox is also distributed for Linux !!! Who should I contact to report bugs with it on Linux ?
I found out proper contact for it, so will follow-up with that person for linux specific issues :wink:

@beegee May I suggest to add in Wiki on that page Installation of Board Support Package in Arduino IDE | RAKwireless Documentation Center in note about adafruit lib to install an indication that you need to get serial python library for upload to work properly with Arduino IDE ?
On Linux system all you need to do is:
pip3 install pyserial in a terminal and you are all good :slight_smile:

1 Like