Simulink unable to upload to Arduino Nano 3.0 Linux

18 visualizaciones (últimos 30 días)
Jason Wang
Jason Wang el 28 de En. de 2020
Comentada: Max Zaki el 11 de Nov. de 2020
System - Ubuntu 18.04
Matlab Version - R2019b
Device - Arduino Nano 3
I connected the arduino nano to the computer. Using matlab support for arduino package I am able to upload code successfully onto the nano. It also works with the regular arduino nano.
I then opened the arduino_getting_started found here
I changed the board to arduino nano 3.0 and selected the correct COM port /tty/USB0.
I am sure this is the correct COM port because it works with the matlab version.
When I pressed upload and deploy to board I encounter the error below.
AVR Memory Usage
----------------
Device: atmega328p
Program: 4252 bytes (13.0% Full)
(.text + .data + .bootloader)
Data: 232 bytes (11.3% Full)
(.data + .bss + .noinit)
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
### Build procedure for model: 'arduino_gettingstarted' aborted due to an error.
The following error occurred during deployment to your hardware board:
Could not connect to specified Arduino board.
Verify that the board is connected to your host, and that the host COM port set in the model matches the COM port name in the host.
To change the host COM port in the model, click 'Simulation ', click 'Model Configuration Parameters'... In the dialog that opens, select the 'Hardware Implementation' pane, click 'Target hardware resources > Host-board connection' and set the COM port number.
To find out the COM port in the host, open a terminal and type ls /dev/ttyACM* in the terminal. Choose the name that corresponds to your board.
I've also tried manually bootloading the code onto the arduino using this command, which succeeded.
~/Documents/MATLAB/SupportPackages/R2019b/3P.instrset/arduinoide.instrset/arduino-1.8.8/hardware/tools/avr/bin/avrdude -C /home/vuwij/Documents/MATLAB/SupportPackages/R2019b/3P.instrset/arduinoide.instrset/arduino-1.8.8/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyUSB0 -b115200 -D -Uflash:w:$(pwd)/arduino_gettingstarted.hex
I've attached the exact slx which caused the problem.
Screenshot from 2020-01-27 23-08-28.png

Respuesta aceptada

Arun Kumar
Arun Kumar el 30 de En. de 2020
Editada: Arun Kumar el 30 de Mzo. de 2020
Hi Jason Wang,
The issue is due to the updated bootloader of Nano board. Old bootloader communicates at 57600 baud whereas the new bootloader communicates at 115200 baud.
Simulink tries to flash using the old bootloader but your board has new bootloader. That's the reason you are seeing this failure.
Workaround:
  1. Flash the old bootloader into nano board using another Arduino as ICSP from Arduino IDE. Please note that you have to select Processor as "Atmega 328P (Old Bootloader)" in Arduino IDE. You can find this setting in tools menu of Arduino IDE.
Support for new bootloader is under consideration and will be added in future releases. If you want to flash using the new bootloader, please contact technical support.
Thanks,
Arun
  1 comentario
Max Zaki
Max Zaki el 11 de Nov. de 2020
This totally worked for me, thank you, Arun Kumar!!
Here's the link I followed on how to flash the old bootloader into the nano using another Arduino as ICSP from Arduino IDE:

Iniciar sesión para comentar.

Más respuestas (1)

varun lal
varun lal el 13 de Oct. de 2020
How can we set matlab2020b to work with old bootloader of arduino nano v3?
  2 comentarios
Arun Kumar
Arun Kumar el 13 de Oct. de 2020
Hi Varun,
You can't use old bootloader with R2020b. Please update the bootloader to use Aduino Nano with R2020b.
-Arun
varun lal
varun lal el 13 de Oct. de 2020
Ok, some problems in updating bootloader, now I am building hex and manually flashing to arduino board

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink Supported Hardware en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by