SOLVED: problem uploading Arduino Sketch

The more technical aspects of Spirit, and carry-over discussion from Kickstarter updates.
gpvillamil
Posts: 75
Joined: Fri Jan 26, 2018 5:03 pm

SOLVED: problem uploading Arduino Sketch

Postby gpvillamil » Sat Feb 03, 2018 11:08 pm

Problem is solved. In the Arduino IDE, select board "Arduino Pro or Pro Mini", then processor "AtMega328P 3.3V 8Mhz" and everything works fine! Thanks to some detective work by Erik Bailey!

===========================================

I'm having a problem uploading an Arduino sketch:

Board type is set to "Arduino/Genuino Uno"

When trying to upload, I get:

Sketch uses 14130 bytes (43%) of program storage space. Maximum is 32256 bytes.
Global variables use 657 bytes (32%) of dynamic memory, leaving 1391 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x80
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x78
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x1e
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x78
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xfe
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x80
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x78
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x1e
An error occurred while uploading the sketch

I can upload with board type set to "Duemilanove" and there is some functionality, but LEDs do not respond correctly (the LEDs light to all white).

The bootloader must be responding, because I've uploaded the base sketch (no function), then the demo sketch (Spirit responds to ultrasonic sensor) but the LEDs don't change color, probably because the board type is wrong.

I've tried this on Mac OS X High Sierra and Windows 7, behavior is identical.

Anything else to try?
Last edited by gpvillamil on Sun Feb 04, 2018 10:34 pm, edited 1 time in total.

User avatar
esba1ley
Posts: 58
Joined: Sun Jan 01, 2017 2:15 am
Location: Pasadena, CA
Contact:

Re: problem uploading Arduino Sketch

Postby esba1ley » Sun Feb 04, 2018 1:02 am

You're using the Arduino IDE, correct?
----------
Erik S. Bailey
Entry, Descent, and Landing Aerospace Engineer
Maker, and Musician
SpiritRover Kickstarter Backer #460

gpvillamil
Posts: 75
Joined: Fri Jan 26, 2018 5:03 pm

Re: problem uploading Arduino Sketch

Postby gpvillamil » Sun Feb 04, 2018 1:08 am

Yep, version 1.8.5

User avatar
esba1ley
Posts: 58
Joined: Sun Jan 01, 2017 2:15 am
Location: Pasadena, CA
Contact:

Re: problem uploading Arduino Sketch

Postby esba1ley » Sun Feb 04, 2018 1:23 am

What programmer are you using?
----------
Erik S. Bailey
Entry, Descent, and Landing Aerospace Engineer
Maker, and Musician
SpiritRover Kickstarter Backer #460

gpvillamil
Posts: 75
Joined: Fri Jan 26, 2018 5:03 pm

Re: problem uploading Arduino Sketch

Postby gpvillamil » Sun Feb 04, 2018 1:40 am

Just over USB. I don’t see any populated headers for another ISP.

The weird thing is that I can upload programs with the “wrong” board (duemilenove): the demo sketch mostly works but the LEDs act weird (they go to full white). I will see if I can configure the Neopixel library to work w a different board type.

I wonder if this related to power or the RPi. I tried disabling the interfaces on the Pi (SPI and I2C), and actually also tried shutting down the Pi over VNC before programming the Arduino.

User avatar
esba1ley
Posts: 58
Joined: Sun Jan 01, 2017 2:15 am
Location: Pasadena, CA
Contact:

Re: problem uploading Arduino Sketch

Postby esba1ley » Sun Feb 04, 2018 1:42 am

Hmmm... have you tried using avrdude directly and trying to read what the board type is? It should be an ATMega328p ... so the signature coming back should be 0x1E 95 0F, I think... Let me look...
----------
Erik S. Bailey
Entry, Descent, and Landing Aerospace Engineer
Maker, and Musician
SpiritRover Kickstarter Backer #460

User avatar
esba1ley
Posts: 58
Joined: Sun Jan 01, 2017 2:15 am
Location: Pasadena, CA
Contact:

Re: problem uploading Arduino Sketch

Postby esba1ley » Sun Feb 04, 2018 2:10 am

Ok... so when I fire up my Arduino IDE (1.6.5) I can connect a serial port monitor to /dev/cu.usbserial-DN02T3WD under MacOS X when I connect the USB cable to the port on the main board. I get the message back:

Code: Select all

baseline:  353   588


when I connect at 57600 baud.

Can you get the same thing?

Still waiting to play with avrdude outside of the Arduino IDE... (MacPorts suggested I update and upgrade outdated... apparently I needed to update QT5 on my machine as well as ffmpeg... both of which need to be built. Yay.)
----------
Erik S. Bailey
Entry, Descent, and Landing Aerospace Engineer
Maker, and Musician
SpiritRover Kickstarter Backer #460

User avatar
esba1ley
Posts: 58
Joined: Sun Jan 01, 2017 2:15 am
Location: Pasadena, CA
Contact:

Re: problem uploading Arduino Sketch

Postby esba1ley » Sun Feb 04, 2018 2:54 am

OK. I was able to replicate the same problems you had...

further problem... I can't get the robot back to its preloaded demo state.

Kevin! Help! What are we doing wrong?

I can get avrdude to replicate what we get from the Arduino IDE like this:

Code: Select all

bash-3.2# avrdude -p m328p -c arduino -P /dev/cu.usbserial-DN02T3WD -v -t -b 57600

avrdude: Version 6.3, compiled on Feb  3 2018 at 18:14:34
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/opt/local/etc/avrdude.conf"
         User configuration file is "/Users/esbailey/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbserial-DN02T3WD
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude>


But when we upload the code, the NeoPixels all turn white, and some of the functions of the demo seem to be slow...

Any ideas, Kevin?
----------
Erik S. Bailey
Entry, Descent, and Landing Aerospace Engineer
Maker, and Musician
SpiritRover Kickstarter Backer #460

gpvillamil
Posts: 75
Joined: Fri Jan 26, 2018 5:03 pm

Re: problem uploading Arduino Sketch

Postby gpvillamil » Sun Feb 04, 2018 2:58 am

Yep that is exactly what I’m seeing: all pixels white, and some functions are slow.

I thought there might be a power issue so I disconnected the wing LEDs.

What board did you select for programming?

Kevin, it would be great to at least restore the demo behaviors!

User avatar
esba1ley
Posts: 58
Joined: Sun Jan 01, 2017 2:15 am
Location: Pasadena, CA
Contact:

Re: problem uploading Arduino Sketch

Postby esba1ley » Sun Feb 04, 2018 4:09 am

I don't think the problem is with the avrdude tool... if it can upload code (which it can) I bet it's how the Arduino IDE is compiling the code in the first place -- I bet there is some kind of pre-complier statement that is assuming the clock rate is twice as fast as it really is. Let me take a look at Kevin's code...
----------
Erik S. Bailey
Entry, Descent, and Landing Aerospace Engineer
Maker, and Musician
SpiritRover Kickstarter Backer #460


Who is online

Users browsing this forum: No registered users and 1 guest