Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving Firmware Programming with ArduinoISP #18

Open
DexterInd opened this issue Jul 24, 2014 · 21 comments
Open

Improving Firmware Programming with ArduinoISP #18

DexterInd opened this issue Jul 24, 2014 · 21 comments

Comments

@DexterInd
Copy link
Collaborator

Let us re-begin.

@DexterInd
Copy link
Collaborator Author

Here's the google doc we put together to document everything that needs to be done, with step by step:

https://docs.google.com/document/d/1QxCeXnmkck9r99hzdpAR_CLuKhQ2-f6hLseoA4FNK7M/edit#heading=h.wk5y3gps0006

Added:

  1. Changes need to be made to the programming cable. Most of the problems we saw (re: Yikes! errors) were due to this: you need to cut out the reset line on the ISP programming cable. If it's connected, the programmer won't work because the reset called on Pin 10 also resets the programming Arduino.
  2. Added a new script for using the Arduino as an ISP programmer from the Raspberry Pi. Hopefully this alleviates the Mac vs. Linux vs. Windows issues.
  3. More pictures.

@stuij
Copy link

stuij commented Jul 24, 2014

Oh dear..

So I followed the guide by the letter. I cut the ribbon, did everything from the pi, etc..

For UC1, I still get the timeout error.

For UC2, I first got a yikes, and then it worked.

I uploaded all the firmware, but noticed that the EEPROM hex files have been removed from the repo after the update. I put them back locally and flashed them as well.

I tried flashing UC1 again, but same error.

I tested UC2 again, and from now on I only got 'yikes'. This is with the exact same setup as not getting the yikes.

So this leaves me with a BrickPi that has only UC2 upgraded to firmware version 2. And there's no way to downgrade again..

I do believe that I've not done anything out of the ordinary when handling the BrickPi. The only thing that is different in my setup is that I've soldered the pins for UC1 onto the board, to make sure there wasn't a loose-connection issue.


Moving on to testing in what state this leaves the BrickPi:

First I get an error in the python setup script. As I did a while back actually:

sudo python setup.py install --record files.txt
[snip]
BrickPi 0.0.0 is already the active version in easy-install.pth
Installed /usr/local/lib/python2.7/dist-packages/BrickPi-0.0.0-py2.7.egg
Processing dependencies for BrickPi==0.0.0
Traceback (most recent call last):
  File "setup.py", line 14, in 
    install_requires=open('requirements.txt').readlines(),
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.linux-armv6l/egg/setuptools/command/install.py", line 73, in run
  File "build/bdist.linux-armv6l/egg/setuptools/command/install.py", line 101, in do_egg_install
  File "build/bdist.linux-armv6l/egg/setuptools/command/easy_install.py", line 373, in run
    
  File "build/bdist.linux-armv6l/egg/setuptools/command/easy_install.py", line 597, in easy_install
    
  File "build/bdist.linux-armv6l/egg/setuptools/command/easy_install.py", line 648, in install_item
    
  File "build/bdist.linux-armv6l/egg/setuptools/command/easy_install.py", line 699, in process_distribution
    
  File "build/bdist.linux-armv6l/egg/pkg_resources.py", line 600, in resolve
    
  File "build/bdist.linux-armv6l/egg/pkg_resources.py", line 2440, in requires
    
  File "build/bdist.linux-armv6l/egg/pkg_resources.py", line 2425, in _dep_map
    pass
  File "build/bdist.linux-armv6l/egg/pkg_resources.py", line 2915, in split_sections
    
  File "build/bdist.linux-armv6l/egg/pkg_resources.py", line 2112, in yield_lines
    match = EGG_NAME(basename)
  File "build/bdist.linux-armv6l/egg/pkg_resources.py", line 2454, in _get_metadata
    `strs` must be an instance of ``basestring``, or a (possibly-nested)
  File "build/bdist.linux-armv6l/egg/pkg_resources.py", line 1371, in get_metadata_lines
    raise NotImplementedError(
  File "build/bdist.linux-armv6l/egg/pkg_resources.py", line 1363, in get_metadata
    if fspath.startswith(self.egg_root+os.sep):
  File "build/bdist.linux-armv6l/egg/pkg_resources.py", line 1428, in _get
    # size and stamp match, somebody did it just ahead of
zipimport.ZipImportError: bad local file header in /usr/local/lib/python2.7/dist-packages/BrickPi-0.0.0-py2.7.egg

Which might be the cause that the files.txt file doesn't exist:

pi@raspberrypi ~/Desktop/BrickPi_Python $ cat files.txt | xargs sudo rm -rf
cat: files.txt: No such file or directory

Next error. A documentation error this time:

pi@raspberrypi ~/Desktop/BrickPi_Python $ cd Sensor_Examples/EV3BETA
pi@raspberrypi ~/Desktop/BrickPi_Python/Sensor_Examples/EV3BETA $ cp BrickPi.py ~/Desktop/BrickPi_Python/
cp: cannot create regular file `/home/pi/Desktop/BrickPi_Python/BrickPi.py': Permission denied

Obviously we should copy the file as root.

Anyways with the system in the state it is in after all of this, I get the successful output messages when running EV3-Firmware_Check.py. However things aren't that rosy:

What works now:

  • the two led-blinky scripts.
  • motors A and B
  • EV3-Firmware_Check.py

What doesn't work now:

  • everything else

What used to work before the flashing: seemingly everything NXT related.

I'll conclude with the avrdude output for the different scenarios. Seemingly the only difference is the text after all the diagnostic output:

AVR not responding:
root@raspberrypi:/home/pi/Desktop/BrickPi/Firmware_BrickPi/Updating_the_Firmware/Firmware_2.0_Loading_Package# avrdude -P /dev/ttyACM0 -b 19200 -c avrisp -v -v -v -p m328p -e
avrdude: Version 5.10, compiled on Jun 18 2012 at 12:38:29
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch
         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/root/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping
         Using Port                    : /dev/ttyACM0
         Using Programmer              : avrisp
         Overriding Baud Rate          : 19200
         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     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
         Programmer Type : STK500
         Description     : Atmel AVR ISP
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
-------------------------------------------
invalid device signature:
root@raspberrypi:/home/pi/Desktop/BrickPi/Firmware_BrickPi/Updating_the_Firmware/Firmware_2.0_Loading_Package# avrdude -P /dev/ttyACM0 -b 19200 -c avrisp -v -v -v -p m328p -e
avrdude: Version 5.10, compiled on Jun 18 2012 at 12:38:29
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch
         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/root/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping
         Using Port                    : /dev/ttyACM0
         Using Programmer              : avrisp
         Overriding Baud Rate          : 19200
         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     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
         Programmer Type : STK500
         Description     : Atmel AVR ISP
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.
avrdude done.  Thank you.
-----------------------------------------------
setup ok:
root@raspberrypi:/home/pi/Desktop/BrickPi/Firmware_BrickPi/Updating_the_Firmware/Firmware_2.0_Loading_Package# avrdude -P /dev/ttyACM0 -b 19200 -c avrisp -v -v -v -p m328p -e
avrdude: Version 5.10, compiled on Jun 18 2012 at 12:38:29
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch
         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/root/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping
         Using Port                    : /dev/ttyACM0
         Using Programmer              : avrisp
         Overriding Baud Rate          : 19200
         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     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
         Programmer Type : STK500
         Description     : Atmel AVR ISP
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
avrdude: Device signature = 0x1e950f
avrdude: safemode read 1, lfuse value: ff
avrdude: safemode read 2, lfuse value: ff
avrdude: safemode read 3, lfuse value: ff
avrdude: safemode: lfuse reads as FF
avrdude: safemode read 1, hfuse value: da
avrdude: safemode read 2, hfuse value: da
avrdude: safemode read 3, hfuse value: da
avrdude: safemode: hfuse reads as DA
avrdude: safemode read 1, efuse value: 5
avrdude: safemode read 2, efuse value: 5
avrdude: safemode read 3, efuse value: 5
avrdude: safemode: efuse reads as 5
avrdude: erasing chip
avrdude: safemode read 1, lfuse value: ff
avrdude: safemode read 2, lfuse value: ff
avrdude: safemode read 3, lfuse value: ff
avrdude: safemode: lfuse reads as FF
avrdude: safemode read 1, hfuse value: da
avrdude: safemode read 2, hfuse value: da
avrdude: safemode read 3, hfuse value: da
avrdude: safemode: hfuse reads as DA
avrdude: safemode read 1, efuse value: 5
avrdude: safemode read 2, efuse value: 5
avrdude: safemode read 3, efuse value: 5
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK
avrdude done.  Thank you.
------------------------------------------------
flashing ok:
root@raspberrypi:/home/pi/Desktop/BrickPi/Firmware_BrickPi/Updating_the_Firmware/Firmware_2.0_Loading_Package# ./Arduino-upload2.sh 
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
avrdude: Device signature = 0x1e950f
avrdude: erasing chip
avrdude: safemode: Fuses OK
avrdude done.  Thank you.
Press [Enter] key to continue ...
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
avrdude: Device signature = 0x1e950f
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.02s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: safemode: Fuses OK
avrdude done.  Thank you.
——[snip]———
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.07s
avrdude: Device signature = 0x1e950f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "ATmegaBOOT_168_atmega328.hex"
avrdude: input file ATmegaBOOT_168_atmega328.hex auto detected as Intel Hex
avrdude: writing flash (32670 bytes):
Writing | ################################################## | 100% 2.48s
avrdude: 32670 bytes of flash written
avrdude: verifying flash memory against ATmegaBOOT_168_atmega328.hex:
avrdude: load data flash data from input file ATmegaBOOT_168_atmega328.hex:
avrdude: input file ATmegaBOOT_168_atmega328.hex auto detected as Intel Hex
avrdude: input file ATmegaBOOT_168_atmega328.hex contains 32670 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 24.31s
avrdude: verifying ...
avrdude: 32670 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done.  Thank you.
Press [Enter] key to continue ...

@stuij
Copy link

stuij commented Jul 24, 2014

And here's a pic of my setup:

img_2763

@DexterInd
Copy link
Collaborator Author

@stuij , got it. I think we can work through this.

First, it looks like your setup is perfect. Your jumpers are correct for UC1 and it appears your programmer cable is correct as well. I can't see from the picture, but you say that you soldered the 6-pin connector into the UC1 port.

I've seen all of these errors. Let's go after them one by one.

Programmer Error:
First, the "Yikes" error and the timeout error, that indicates to me that something might not be making contact correctly during the programming phase (the ArduinoISP programmer isn't getting the correct response from the chip). To add some pressure and insure contact on the BrickPi, I pinched between the Port5 and the programmer, during the entire programming script. I used another finger to make sure the reset jumper was making contact. Can you try this again with a little bit of a pinch?

Test Document:
We've got our intern running the whole installation again today to see if I missed anything when I wrote it yesterday. He found that for some reason he had to re-run the command

sudo python setup.py install --record files.txt

A second time. After running that line a second time the file "files.txt" appeared. Once it appears, you can run the "cat files.txt" command. The error you're seeing is that it doesn't see the files.txt file.

Finally, it looks like from your debug script that you didn't get through the last two writes (I see you've succesfully gotten the fuses and then the Arduino bootloader burned). But I don't see succesfull feedback (or any feedback) for the second hex file or the EEPROM file. Did you not paste that or was that not generated?

Couple more notes:

  • Thanks for catching the EEPROM issue; I got a little overzealous with deleting files. Added back in.
  • Added sudo to the commands that need it in the document.

@stuij
Copy link

stuij commented Jul 25, 2014

Sorry, but I can't parse 'pinched'. You mean push down a bit on them?

And yes, I omitted the writes. Everything got written correctly on UC2.

@DexterInd
Copy link
Collaborator Author

Pinched: We'll take a picture and put it into the document. Give us 10 minutes.

@stuij
Copy link

stuij commented Jul 25, 2014

I guess you mean with pinching, to push them together a bit.

So I pushed them together a bit, I pushed them out a bit, I carved up another SPI cable to see if that works, I replaced the reset cable. All the while of course pushing the reset cable onto the right contact. Tried different hand placements. Nothing works.

@DexterInd
Copy link
Collaborator Author

So here's an attempt to explain what I mean by "pinching". You need to make sure you have contact between all pins. Pushing down into the board won't do that. But pushing the programmer (and the reset pin) to the side, pinching them if you will, will ensure you have contact.

pinching

@DexterInd
Copy link
Collaborator Author

The above picture is showing which way the force should be going with your fingers.

@DexterInd
Copy link
Collaborator Author

Those thumbs are copyright Govinda, our intern.

@stuij
Copy link

stuij commented Jul 25, 2014

I would advice you Govinda to leave the electronics business and become a hand model while you're still young.

Unfortunately I'm getting 'not-responding' errors whichever way I push and pull. I might have the wrong thumbs. I think it's one of the reasons my guitar-playing career never took off.

I did manage to downgrade UC2, by pinching the right bits. I tested and this leaves me with a working system, albeit a miserable 1.x one. Progress!

So yes, something on the BrickPi isn't getting through to the chip. Could it just be that something is faulty on the hardware level?

The python hack worked.

@DexterInd
Copy link
Collaborator Author

Govinda's not in it for the fame. He's in it for the love of electronics.

I'm still convinced that the problem is that the programmer isn't making the correct connection. If you can program and reprogram the UC2, the UC1 should be programming as well. Is there any difference between the two?

@stuij
Copy link

stuij commented Jul 25, 2014

A wise choice in the long run I'm sure.

My last resort is the prongs I soldered onto the UC1 programmer holes. I can desolder them and see what gives. That's really the only difference.

@suranyami
Copy link

So, I retried this again.

To make life easier for myself, I soldered 2 x 3 header pins onto the BrickPi on UC1 & UC2. This avoids the whole "pinching" thing.

  1. First mistake I made was inserting the cable the wrong way around on the BrickPi. After reading the troubleshooting notes in the Google Doc installation instructions, it became clear that was why I was getting device signature failed.
  2. Second mistake I made was not using sudo when running the Arduino-upload1.sh script.
  3. Third mistake I made was forgetting to connect (and pinch) the reset pin from Arduino pin 10 to the correct reset hole for each processor.

Now it managed to set the fuses and write and verify to the Flash. I got up to the very final stage of the script.

However, now it's failing on the EEPROM verification stage (avrdude -P /dev/tty.usbmodem1411 -b 19200 -c avrisp -F -p m328p -U eeprom:w:BrickPi_EEPROM_UC1.hex):

verification error, first mismatch at byte 0x0000

What's the most likely cause of this?

Also, I think that Google doc would be better added to the repo as a MarkDown file. I'll convert it.

@suranyami
Copy link

Tried one more time. Success!

I suspect my previous failure might have been because I moved during the process and a cable lost contact.

So, what I did this time that seemed to help is pinch the reset pin and feed the wire through some of the GPIO pins so that the whole thing was stable.

I then re-ran the Arduino install scripts, and all steps verified. Will now test with the sensor.

Thanks!

@suranyami
Copy link

New problem.

So, when I try to confirm the Firmware upgrade has worked, by following the instructions and run:

sudo python EV3-Firmware_Check.py

Traceback (most recent call last):
  File "EV3-Firmware_Check.py", line 15 in <module>
    from BrickPi import *   #import BrickPi.py file to use BrickPi operations
  File "/home/pi/Desktop/BrickPi_Python/Sensor_Examples/EV3BETA/BrickPi.py", line 138
    ========
     ^
SyntaxError: invalid syntax

What's this about?

@suranyami
Copy link

Fixed this. It was apparently a typo that got left in there by someone. Just deleted the =======.

Was able to run the EV3-Firmware_Check.py script. This is what I get now:

pi@raspberrypi ~/Desktop/BrickPi_Python/Sensor_Examples $ sudo python EV3-Firmware_Check.pyTrying to communicate with firmware.
PASS: Successfully connected to BrickPi.
PASS: Hardware seems to be running normally.

Checking Firmware Version of BrickPi.
Firmware version is: None
DOH!  Please update your firmware to run EV3 sensors!
You should be able to run NXT sensors, but not EV3 sensors.

So, have you uploaded the correct .hex files to GitHub?

Maybe they're correct in the ev3dev branch but not master?

@suranyami
Copy link

I did a diff between the hex files in the EV3_firmware_dev branch and master, and some were different.

I uploaded the newer ones from EV3_firmware_dev and re-ran the EV3-Firmware_Check.py script and got the same message as above.

Should I assume that the .hex files may not necessarily have the most up-to-date versions of the compiled binaries?

I guess I'm going to have to compile them myself, then?

Losing lots of confidence with this entire endeavour.

@DexterInd
Copy link
Collaborator Author

@suranyami So glad to hear we're getting more success. Your point on the Google Docs is well taken, we will try to get it up on our site soon.

The compiled firmware versions should be correct (the .hex files). I think the problem is that you will need the EV3 touch sensor on Port 4 to get a correct reading back.

We probably need to make this more visible. But for the test to work, an EV3 touch sensor should be on Port 4 and pressed when the program starts:

This program will check for the correct firmware version.
The Touch sensor is attached to Port 4.
When the touch sensor is pressed, the output should read "1"

@suranyami
Copy link

I tried again with an EV3-Touch sensor on Port 4, sensor pressed.

Same result. Are you sure about this? I was running the EV3-Firmware_Check.py script, not the EV3-Touch.py script.

Either way, it says Firmware version is:None`

Is there another way to test the firmware is working?

@BradEsquire
Copy link

Thanks for the heads up with the error in the script suranyami. I've had a lot of fun today trying to get the updated firmware working on the BrickPi today and the error in the script (which appears to have not been corrected 6 months after you reported it) was a frustration I didn't need. All looking good now though!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants