Update BrickPi FW with USBASP Programmer [SOLVED]

@karan
Hey, could you tell me what to do next? Im late with my project and I can’t even start developing its program. I need ev3 gyro working and right now I can even run motors. I posted here all the steps I’ve done and it’s output. Electronics,esp. so closely hardware connected is not my thing and I’m afraid I ruin it more. Please help me.

Took us some time to pick this apart. This is why we write scripts! :slight_smile:

The short of it: from your screenshots, you’re writing the EEPROM to flash, not to EEPROM. If you look at this image:

You are writing the command
flash:w:BrickPi_EEPROM_UC1.hex
when you SHOULD be writing the command
eeprom:w:BrickPi_EEPROM_UC1.hex

When you write with flash, it overwrites the main program and you’re putting the memory for EEPROM where the flash should be put. So you should be able to solve this by running all the commands again, but changing the last one to write to eeprom, not flash.

@JohnC
I redid all commands and ran fw check. It freezes on setting up sensors. Same goes when I try to run motor from python console.
input:
script.txt (391 Bytes)

Output :
out1-12.05.16.txt (7.5 KB)
out2-12.05.16.txt (7.5 KB)

I got couple more questions:
in your repo there are few folders with firmware, ie. 2.5, can i go into that folder and run this scripts to get 2.5? I ran script here:

I’d also like to confirm if I properly connected pins to the board. Maybe that causes problems.

I’ll try to go through this one more time, carefully checking for spelling.

Meanwhile your raspian image updated, I got something calling itself google pixel? I also have to run python with sudo because it can’t get access to tty without it. (my user is in tty group)
EDIT: attempt2 fail, stuck at this for few minutes now:

Again, combing carefully through this, in a couple places you’re getting this warning:

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

I’m not sure what that is, but it seems like there’s a problem with the usbasp programmer. Is there any way you could try to do this with an Arduino?

Yes, you should be able to do that. But remember those batch files are written for the spefic mk2 and Arduino programmers.

Just double checked and yes, those are correctly chosen.

Not sure what that is; do you have a screenshot? When did you see something about Google Pixel?

That will certainly happen if you’re not getting a response from your BrickPi; it will just hang and eventually give up.

This might also be helpful: http://www.avrfreaks.net/forum/avrdude-warning-cannot-set-sck-period-please-check-us
If you’re using a long USB cord on your programmer, you might have problems, or a hub or something else.

@JohnC Thank you very much. No I am not using long cord but six single-pin wires about 15cm long. I’ve asked my friend to lend me arduino. Tomorrow I’ll also check if my soldering is properly done. First time I noticed that message about SCK period I tried googling that and found in few places that this can be ignored. But since it’s not working well it might be one of the reasons. Anyway. I’ll get arduino and try again.

As for that update… on your fresh image’s desktop I noticed update software icon so I clicked it. It installed tons of software and after rebooting I got pixel. I will provide screenshots tomorrow, but for now:


Those look exactly the same. I also got problems with bluetooth (it is off but I managed to turn it on once and it worked till reboot) but thats another story I think.

Thanks again for any help, I really do hope to start programming soon and finish my project. It has been one failure after the other disaster till this point :frowning:

Eeeeh
So… I installed Arduino IDE (for drivers) , connected wires (reset one as you said) and ran script (yours, but I had to delete ifs because it didn’t find AT_mega… file… weird it was in the same directory) anwyay… it went on and stopped right on start, on the first fuse… after few minutes of nothing I gave up and got back to usbasp. I added -b 19200 to commands as it is in your script but that didn’t help. Still “cannot set sck period” In the link you gave David says:

Ah-ha. I was going to suggest that you Google: "avrdude : warning : Can not Set sck period . usbasp please check for firmware update "
However most of the first hits gave silly advice.
A modern Chinese USBASP will set the SCK period automagically.
There is NO reason to upgrade the firmware. Just ignore the warning.
Historically, the first USBASP design used a SLOW jumper. The first fischl.de firmware did not support “setting sck period” with the -B# switch.
So the only people who need to upgrade firmware are those with a very old home-made usbasp.
David.

So Im left with nothing solid. I guess I have to find AVRISPMK2 but that is hard because it seem old and Im in different country, and I don’t feel like paying more than 15USD for something I’ll use only once

I think Im giving up… Could I maybe send it to you guys so you could check whats wrong with it?

We’re going to check into the Pixel issue, I’m not sure why that’s happening.

Let me think about this a little more, we might be missing something on the software programming side.

Update BrickPi FW with USBASP Programmer [SOLVED][quote=“mike2060, post:11, topic:2122”]
So… I installed Arduino IDE (for drivers) , connected wires (reset one as you said) and ran script (yours, but I had to delete ifs because it didn’t find AT_mega… file… weird it was in the same directory) anwyay… it went on and stopped right on start, on the first fuse… after few minutes of nothing I gave up and got back to usbasp. I added -b 19200 to commands as it is in your script but that didn’t help.
[/quote]

With the Arduino, did you install the ISP program on the Arduino? This is the tutorial that walks you through that here.

Steps 1-4 are crucial, and note that they vary a little if you’re using Arduino 1.0. Did you take this step with the Arduino programmer?

Yesterday I borrowed another USBASP. Updating process lasted way longer with the first usbasp but it didn’t work. In python IDLE it still stucks on BrickPiSetupSensors(). I also tried uploading FW 2.5. Also not working.

Today I took arduino. I’m not sure if it is 1.0 so I used unmodified ISP example. Updating process went faster than with that second usbasp but slower that the first. And also failed on BrickPiSetupSensors().
Here the outputs:
out1-10.12.16-arduino.txt (8.3 KB)
out2-10.12.16-arduino.txt (7.5 KB)

That pixel image. It looks nice. There might be a chance that it prevents brickpi from working, I doubt it, but who knows?

Hey @Mike2060 re: Pixel. We had three folks try the update out and it did not change the Raspbian for Robots image over to Pixel. So I’m wondering if you might have manually done a sudo apt-get upgrade in the command line manually? This might have caused Pixel to come up.

And this ties into something else we dealt with earlier this week; if you’re running the Pi 3 (and even maybe the other Pi’s) and you have upgraded to Pixel, you might be inhibiting the serial lines. There’s a known issue that we put a workaround in for the BrickPi, where the new Bluetooth lines break the serial lines unless you use a special dt overlay. I would recommend re-burning a new card with our December image; I just updated it last week.

Again, I admire your patience and persistence with this.

And I just went through those two scripts; they look like the firmware was updated correctly and successfully. I will double check them again, but it looks like they went well and verified. And I double checked your eeprom write, great job! :slight_smile:

There is such possibility. I was trying very hard to make BT working using several tutorials so I might have run apt-get upgrade. I’ll load your image right now.
Thanks, I got similar amount of problems in any project I start so, yeah, I have to be very patient ;D

@JohnC
Alright finally some good news. I’m able to run motor, so I guess rest of NXT stuff works to. However running EV3-Firmware_Check produces following output:
Trying to communicate with firmware.
PASS: Serial line setup.

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

So I think my ev3 gyro wont work.
Should I rerun update procedure for software from 2.5 folder?

Hey @mike2060 does updating the firmware to 2.5 work then?

Hi @JohnC
No, it’s worse. FW check says

Trying to communicate with firmware.
PASS: Serial line setup.

Setup sensors returns: -1
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.

And on BrickPiSetupSensors() it returns -1

does python have any debug log? maybe there are some clues there?

Well at least updating procedure works :slight_smile: (with arduino though)

Hmm. Ok, so I’m glad we’re making progress (sort of? :slight_smile: ) Just making sure; the latest firmware is 2.5. That has EV3 code in it and some updates. (See here). The specific and important file for flashing is “BrickPiFW_2.5.hex”; just want to make sure in all the file shuffling that we used that file for sure; and not an older version.

My setup:

I created new directory and cloned your repo. I entered newClone\BrickPi\Firmware_BrickPi\Firmware_2.5 and there is no arduino script.

Then I opened first script:

Look on 5th and 39th line. Is that ok?
Same stuff is in “newClone\BrickPi\Firmware_BrickPi\Updating_the_Firmware\Firmware_Loading_Package_2013.07.05\BrickPiFW_UC1 - Arduino Script.bat”
And guess I need to change “avrispmkII” to arduino’s “avrisp”.
So I modified scripts (I only changed the begging of lines, all right from -U stayed as it was):


At this point I noticed that the file you mentioned is mentioned in scripts and compressed comunications is not in the folder with scripts.
If I run the scripts now it will end just like it ended in my previous post. I think its because, later I removed checking for files and it went on and ‘used’ not existing compressed comms and that is why it has failed. I think you might have forgotten to change scripts after copying it from other directory.

Should I change compressed comms to that file you mentioned? Well I’ll go ahead and do that.

EDIT: INSTALLING:
During installation orange led on arduino is blinking. Maybe that will indicate something to you.
Anyway here are outputs:
out1-13.12.2016.txt (5.5 KB)

out2-13.12.2016.txt (5.5 KB)

I attached motor to port A and gyro sensor (EV3) to port s4.

pi@dex:~/Desktop/BrickPi_Python/Sensor_Examples $ sudo python EV3-Firmware_Check.py
Trying to communicate with firmware.
PASS: Serial line setup.

Setup sensors returns: 0
Checking Firmware Version of BrickPi.
Firmware version is: 2
GREAT!  Firmware is up to date!
You should be able to run EV3 sensors!

HURRAY!
FW v is 2 but as long as gyro works I’m happy !

HUGE THANK YOU GUYS ! You are the best !

EDIT 2 :
GYRO WORKS! - it used to give me 0 or 1043 but now when i move it it gives me more data. Negative and positive. That’s nice ;D

Hurray! So glad this is working!! Great work, and thanks for your patience!

As a note: those green boards are pretty old, I’m amazed you have one. That would have been our very very very first batch of BrickPi from way back in the day!