Downloads
release
dev builds
extras
themes
Documentation
manual
wiki
device status
Support
forums
mailing lists
IRC
Development
bugs
patches
dev guide
Search
Donate
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Welcome to the Rockbox Technical Forums!
Rockbox Technical Forums
Third Party
Repairing and Upgrading Rockbox Capable Players
Reflashing H120 via BDM (done, with pics)
« previous
next »
Print
Pages: [
1
]
Author
Topic: Reflashing H120 via BDM (done, with pics) (Read 4795 times)
ReK
Member
Posts: 4
Reflashing H120 via BDM (done, with pics)
«
on:
July 07, 2009, 09:00:48 AM »
Ages ago I nuked my H120's flash (the red warning at the bottom of the IriverFlashing page... that's because of me). After looking at the BDM protocol it looked straightforward enough to try to fix it. I've gotten the important signals wired up (TDI, TDO, BKPT, DSCLK, PST0-3) and a basic implementation of parts of the BDM protocol, but I'm having a few issues.
First is getting the chip to halt. Pressing the power button with BKPT held low gets to PST=0xE mode, stopped but not halted. The H120 powers off a second or so after the button is released. Lowering and raising the reset pin doesn't seem to make it change. Is there anything specific to the H120 that needs to be done to make it work? The docs CF5249 docs mention the MTMOD pins, but they don't seem to be brought out to the board anywhere.
Secondly, I've yet to figure out what to write to the chip once I get the BDM working. Roughly, I need at least a few bytes of machine code to map the flash. Is it possible to use BDM write commands to rewrite the flash, or does that need to be done from code running on the chip? Also, is there a minimal bootloader or something I can write? I'm using an atmega88 with 8k of flash, and it would be nice to avoid setting a USB interface to write the full 44k bootloader.
«
Last Edit: July 17, 2009, 09:46:32 AM by ReK
»
Logged
ReK
Member
Posts: 4
Re: Reflashing H120 via BDM
«
Reply #1 on:
July 17, 2009, 09:46:15 AM »
After a few days of messing around I did it. I've written up the process on the wiki (
http://www.rockbox.org/twiki/bin/view/Main/H1x0Reflashing
) but I thought I'd put some other info here.
For the first problem (the chip halting)... I think the problem was just that the BKPT wire had fallen off or something. It was probably more than that, and it had fallen off, but that eventually worked. The chip _is_ set to boot into BDM mode, rather than JTAG.
For the second problem (the code to run on the chip) I found a useful
article
with a basic makefile, link script and assembly code that was enough to get it working. Fixing these up and cribbing some code from the rockbox CRT and bootloader were enough to get it working. A lot of the code ended up being stuff cribbed from rockbox.
A few pictures:
The backlight turned on. No progress on the flash at this point, just gotten the BDM communication working (and working init code)
Wires attached to pin headers (the wires are too skinny to stick into a breadboard). The solder points are relatively large, so an 0.8mm tip was small enough to do it fairly easily. I somehow failed to notice the H120 was still turned on while I desoldered everything. Seemed to go ok anyway. One of these days I really should get it open again and clean up the leftover flux.
Normally this error message would be pretty annoying, but the HDD had to be removed because it covers up the debug points. Much better than it not turning on.
After all that, I've still got one torx screw left over. I _think_ it's from my other (lost, repainted) H120...
Logged
Multiplex
Member
Posts: 440
Re: Reflashing H120 via BDM (done, with pics)
«
Reply #2 on:
July 18, 2009, 09:26:26 AM »
Cool - I hope I never need this information though!
Logged
Chronon
Rockbox Expert
Member
Posts: 4379
Re: Reflashing H120 via BDM (done, with pics)
«
Reply #3 on:
July 18, 2009, 01:31:43 PM »
Thank you for putting this together and posting it to the wiki.
Logged
Sansa e280, Gigabeat F40, Gigabeat S60, Sansa Clip+, iPod Mini 2g
kpapr1
Member
Posts: 27
Re: Reflashing H120 via BDM (done, with pics)
«
Reply #4 on:
August 26, 2009, 05:37:48 PM »
Hi, which AVR did you use? The schematic refers to the MEGA8 while the info says it's the MEGA88.
edit: OK, you have already mentioned that in the beginning of the post, it's the MEGA88. So, it's just wrong name on the schematic, I guess.
«
Last Edit: August 26, 2009, 06:12:49 PM by kpapr1
»
Logged
kpapr1
Member
Posts: 27
Re: Reflashing H120 via BDM (done, with pics)
«
Reply #5 on:
September 26, 2009, 04:53:16 PM »
I have a few questions :
1. No xtal on the schematic. Do you use the 8MHz internal clock, or an external 16MHz clock like a readme file somewhere says?
2. I suppose bdm.hex is the program file to flash into the AVR
3. I need to compile usbdump.c but the libusb.h is missing. Where can I find it?
4. If I understand correctly the procedure is this:
a) connect wires+usb from H1x0 to AVR and power up. The H1x0 will enter hault mode.
b) power-off AVR (H1x0 will remain ON), disconnect usb from avr and connect to PC
c) run usbdump reflash.bin
Is it correct, or do I need to compile/do anything else ( besides usbdump)?
Thanks
edit: I found the missing library, but now I get a lot of linker errors
«
Last Edit: September 27, 2009, 04:50:56 AM by kpapr1
»
Logged
ReK
Member
Posts: 4
Re: Reflashing H120 via BDM (done, with pics)
«
Reply #6 on:
September 27, 2009, 06:55:09 AM »
1. Err, forgot to put that in. 16mhz crystal with the usual capacitors to ground. You can use other crystals (12, 16, 20), but v-usb needs to be reconfigured and rebuilt.
2. Correct.
3. Install libusb, that should be the only dependency.
4. No, the reflashing is done through the AVR. Wire it all up, turn on the H120, and it should enter the halted state (the AVR will be on because it's getting power via USB). Then run usbdump on the attached PC and it should reflash. Offhand I think you can make the USB connection after the H120 has been powered up (the H120 powers the board), but I'm not sure.
Logged
kpapr1
Member
Posts: 27
Re: Reflashing H120 via BDM (done, with pics)
«
Reply #7 on:
September 27, 2009, 08:23:46 AM »
Thanks for the clarifications.
So, if I understand correctly, I need to have both AVR and iriver connected to the PC?
I put the libusb.h in the include directory but now I get a lot of linker errors. Is there something else I must configure in the C compiler?
Logged
ReK
Member
Posts: 4
Re: Reflashing H120 via BDM (done, with pics)
«
Reply #8 on:
September 29, 2009, 08:17:20 AM »
The iriver will be connected to the AVR, via the debug lines. The AVR will be connected to the computer via USB. You can't just include the header, you'll need to install the full libraries to link against them.
Logged
Print
Pages: [
1
]
« previous
next »
Rockbox Technical Forums
Third Party
Repairing and Upgrading Rockbox Capable Players
Reflashing H120 via BDM (done, with pics)
SMF 2.0.17
|
SMF © 2019
,
Simple Machines
Rockbox Privacy Policy
XHTML
RSS
WAP2
Page created in 0.084 seconds with 15 queries.