The Artima Developer Community
Sponsored Link

Python Buzz Forum
11

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Aaron Brady

Posts: 576
Nickname: insommeuk
Registered: Aug, 2003

Aaron Brady is lead developer for Crestsource
11 Posted: Jun 11, 2016 12:44 PM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Aaron Brady.
Original Post: 11
Feed Title: insom.me.uk
Feed URL: http://feeds2.feedburner.com/insommeuk
Feed Description: Posts related to using Python. Some tricks and tips, observations, hacks, and the Brand New Things.
Latest Python Buzz Posts
Latest Python Buzz Posts by Aaron Brady
Latest Posts From insom.me.uk

Advertisement

I am become yak, destroyer of progress.

I was playing with one of my left-over populated Radio 1 boards. I’ve recently gotten a USBasp (knock-off) from eBay and back when I was designing the board I actually thought ahead. I put a standard 6-pin programming header on the board, even though I was just using a Bus Pirate to flash them.

I wasn’t sure what state the fuses and firmware were in, so I read them with avrdude and plugged them into an online fuse calculator. That’s when I saw you can actually clock these down to 128KHz on the internal RC oscillator. Interesting! The board was running a version of the Arduino blink sketch anyway - how slow is 128KHz? So, I set the fuses to find out:

% avrdude -c usbasp-clone -p m328p -U lfuse:w:0xe3:m
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions
avrdude: writing lfuse (1 bytes)

(Check out that warning: it’s going to be relevant in a minute).

Flashing the Radio 1 board

Cool, so at this rate it takes an age to flash the LED. I’m not sure what I was expecting. I’ll just put it back how it was:

% avrdude -c usbasp-clone -p m328p -U lfuse:w:0xe2:m
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

Ruh-roh.

The 328 is now clocked too slow to speak SPI at the default rate, so I can’t flash it back. The USBasp is running too old a firmware to slow down its clock. Now to begin “a game of programmers”.

I need to use the USBasp to program a Boarduino with the Arduino firmware (it previously had its Arduino bootloader wiped):

ASP on Boarduino Action

Then I use the FTDI to put the ArduinoISP sketch on the Boarduino, and upload new firmware onto the USBasp:

Revenge of the Boarduino!

% avrdude -c avrisp -p m8 -P /dev/ttyUSB0 -b 19200
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e9307 (probably m8)

Now I can use the USBasp to fix the Radio 1 board:

% avrdude -c usbasp -p m328p -U lfuse:w:0xe2:m -B 1000
avrdude: set SCK frequency to 1000 Hz
avrdude: AVR device initialized and ready to accept instructions
avrdude: writing lfuse (1 bytes):

Success! Now I’m back at the beginning!

Well, while I’ve got all this kata in my head, I might as well put the Arduino bootloader back on some other knock-offs:

Deek Robot Arduino Mini

Right, now I can get some work done. Oh. It’s dark out. Maybe tomorrow.

Read: 11

Topic: Z80 Microcomputer Previous Topic   Next Topic Topic: 09

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use