-
Notifications
You must be signed in to change notification settings - Fork 167
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
Comments
Here's the google doc we put together to document everything that needs to be done, with step by step: Added:
|
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:
What doesn't work now:
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 , 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: Test Document: 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:
|
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. |
Pinched: We'll take a picture and put it into the document. Give us 10 minutes. |
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. |
The above picture is showing which way the force should be going with your fingers. |
Those thumbs are copyright Govinda, our intern. |
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. |
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? |
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. |
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.
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 (
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. |
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! |
New problem. So, when I try to confirm the Firmware upgrade has worked, by following the instructions and run:
What's this about? |
Fixed this. It was apparently a typo that got left in there by someone. Just deleted the Was able to run the 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 Maybe they're correct in the |
I did a diff between the hex files in the I uploaded the newer ones from Should I assume that the I guess I'm going to have to compile them myself, then? Losing lots of confidence with this entire endeavour. |
@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. |
I tried again with an EV3-Touch sensor on Port 4, sensor pressed. Same result. Are you sure about this? I was running the Either way, it says Is there another way to test the firmware is working? |
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!!! |
Let us re-begin.
The text was updated successfully, but these errors were encountered: