Simulink unable to upload to Arduino Nano 3.0 Linux

조회 수: 18 (최근 30일)
Jason Wang
Jason Wang 2020년 1월 28일
댓글: Max Zaki 2020년 11월 11일
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

채택된 답변

Arun Kumar
Arun Kumar 2020년 1월 30일
편집: Arun Kumar 2020년 3월 30일
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
Max Zaki
Max Zaki 2020년 11월 11일
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:

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

varun lal
varun lal 2020년 10월 13일
How can we set matlab2020b to work with old bootloader of arduino nano v3?
  댓글 수: 2
Arun Kumar
Arun Kumar 2020년 10월 13일
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 2020년 10월 13일
Ok, some problems in updating bootloader, now I am building hex and manually flashing to arduino board

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Supported Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by