XboxHacker BBS
 
*
Welcome, %1$s. Please login or register.
Did you miss your activation email?
July 27, 2016, 12:12:29 PM




Author Topic: USB SPI Flasher with PIC18F2455 - now with source and binaries  (Read 431217 times)

DarkstarTM

  • Member
  • **
  • Posts: 45
    • View Profile




This flasher can be built for about 5 Euros on breadboard (or even without breadboard). All components are available from Reichelt (Germany) or Digikey.
It takes about 5 minutes for 16 MB. The USB protocol is compatible with NandPro.

PIC Firmware
Update: PIC Source code for this board is at http://free60.git.sourceforge.net/git/gitweb.cgi?p=free60/tools;a=tree;f=picflash
The final pinmapping is at http://free60.git.sourceforge.net/git/gitweb.cgi?p=free60/tools;a=blob;f=picflash/readme.txt

Binaries (V3)
http://www.megaupload.com/?d=X6TBNFDC

Programming the PIC
See http://free60.git.sourceforge.net/git/gitweb.cgi?p=free60/tools;a=blob;f=picflash/boot/readme.txt

Update: Shopping list

For the Flasher:
1x HPR 50X100      Breadboard
1x CST 12,00      12 MHz Resonator
1x Z5U-2,5 220N      Capacitor
1x Z5U-2,5 100N      Capacitor
1x 1/4W 10K      Resistor
6x 1/4W 100      Resistor
2x SL 1X36G 2,54      Pin Headers (male)
1x PIC 18F2455-I/SP   the PIC
1x LITZE SW      Some wire
3x BL 1X10G 2,54      Pin Headers (female)
1x USB BG         USB Connector
1x AK 670/2-1,0      USB cable

For the porgrammer:
1x 74HCT 573      Driver IC
1x 1/4W 270      Resistor
1x 1/4W 1,0K      Resistor
1x D-SUB BU 25      LPT Connector

The part names are from www.reichelt.de.
« Last Edit: September 20, 2009, 08:35:28 AM by DarkstarTM »
Logged

Spider85

  • Hacker
  • ***
  • Posts: 56
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #1 on: August 31, 2009, 11:56:40 PM »

Iam really looking forward to the details :)
Tnx!
Logged

kelv_uk

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #2 on: September 01, 2009, 02:12:43 AM »

Thanks DarkstarTM, knew there was a reason I kept those knackered ICD2's, was planning on trying with 18f14k50 as a cheap way of doing it, wont bother now :)
Please dont loose the source!!!! ;)
Logged

GyTe

  • Member
  • **
  • Posts: 45
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #3 on: September 01, 2009, 03:19:29 AM »

Well done :) Stick here for the details

Logged

Hoax

  • Hacker
  • ***
  • Posts: 87
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #4 on: September 01, 2009, 03:23:59 AM »

Nice! Good job!

Hehe.. exactly what GyTe was looking for ;) Maybe he has more luck this time..
Logged

Gee99x

  • Hacker
  • ***
  • Posts: 88
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #5 on: September 01, 2009, 04:15:43 AM »

Sweet!! To the guys that are going to attempt this build- you'll still need a PIC programmer. http://www.circuit-projects.com/microcontroller/pic-and-eeprom-programmer.html
« Last Edit: September 24, 2009, 10:27:15 AM by Gee99x »
Logged

Andy1988

  • Member
  • **
  • Posts: 14
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #6 on: September 01, 2009, 07:51:55 AM »

Nice! Especially that you are releasing the sources! :D

I was just getting in touch with the SPI protocol and today I etched a board for an Atmega8 to use it as an SPI flasher.

It took me a few days to get some stuff that works for sniffing the NandPro protocol... And I'm just able to get the flashconfig. At least sometimes... I think my cables are too long. My own board isn't finished yet, so I hooked up an STK500.

Several things I tried for sniffing:
1) The Logic Analyzer I used for sniffing didn't have a protocol analyzer and counting clock cycles was boring and just sucked ;)
2) Using an AVR to sniff the SPI stuff "on the wires" didn't work out... Perhaps too fast.
3) MS Detours for hooking the DLL calls to DLPortIO didn't work, too.
4) Then I created my own DLPortIO.dll, loaded the real DLPortIO.dll and delegated the calls of NandPro to the real ones and logged everything. That worked finally.
Oh and a whole bunch of diasassembling-fun of NandPro :D
At least I learned very much doing all this stuff.

I think that the SPI protocol that is used for reading/deleting/writing is the same as in lflash, right? I haven't looked at it, as I'm not yet able to read the flashconfig reliably :-/
http://free60.git.sourceforge.net/git/gitweb.cgi?p=free60/tools;a=blob_plain;f=lflash/lflash.c;hb=HEAD

How did you find out the protocol?
« Last Edit: September 01, 2009, 07:56:46 AM by Andy1988 »
Logged

DarkstarTM

  • Member
  • **
  • Posts: 45
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #7 on: September 01, 2009, 08:29:57 AM »

How did you find out the protocol?

I read the ARM assembly for the LPC2148 board. Got the relevant register addresses from the datasheet to find SPI I/O stuff. Reversing the USB protocol was the harder part.
For signal checking signal integrity I used a small DSO. For protocol checking I used a logicport (http://www.pctestinstruments.com/).
Logged

Andy1988

  • Member
  • **
  • Posts: 14
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #8 on: September 01, 2009, 08:42:53 AM »

OK... You've got the better equipment ;) The logic analyzer I was using just showed me the logic levels. It's a pain to count the clock cycles. Especially if you are wrong everytime.

For the USB protocol you could have used my DLL wrapping trick with the libusb dlls :)
But I never did anything with an ARM. So I had to stick with the x86 assembly :D And even with that I haven't much experience.

What datasheet do you mean?
Logged

maximilian0017

  • Xbox Hacker
  • *****
  • Posts: 684
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #10 on: September 01, 2009, 11:54:31 AM »

I was just getting in touch with the SPI protocol and today I etched a board for an Atmega8 to use it as an SPI flasher.

As the Mega8 doesn't have a native usb connection, you are incorperating Bit-bang USB?
Logged

Andy1988

  • Member
  • **
  • Posts: 14
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #11 on: September 01, 2009, 12:08:10 PM »

Yup...
http://www.obdev.at/products/vusb/index-de.html

I don't know how fast this stuff will be. I never transmitted that much data with this stack :(

If this gets too slow, I'll try to take the USBProg as a base. This thing is an USB Programmer for several purposes with hardware USB controller:
http://www.embedded-projects.net/index.php?page_id=165
Logged

gadget78

  • Master Hacker
  • ****
  • Posts: 104
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #12 on: September 01, 2009, 12:16:17 PM »

this is some amazing work, and so quick too :)

only one request is it poss, to use a PIC 16C745 i know its a little slower, (and once programmable but they half the price)
would it be quick enough to cope ? (i think this is the closest 16Xxxx alternative? as then it will support my hardware/programmer!)
not to worry if not, will give me an excuse to upgrade i suppose !

again many thanks :) Mick ..
Logged

Gee99x

  • Hacker
  • ***
  • Posts: 88
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #13 on: September 01, 2009, 01:12:54 PM »

DarkstarTM, would a 10MHz or 16MHz Resonator work instead of the listed 12MHz? Reason that I ask is because I can't get a 12MHz.
Logged

danhans115

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #14 on: September 01, 2009, 02:19:54 PM »

I would have thought anything timing related will be coded for 12MHz so by changing the oscillator to a lower or higher speed will break any timing critical code.
Logged

B1N4RY

  • Xbox Hacker
  • *****
  • Posts: 790
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #15 on: September 01, 2009, 02:32:26 PM »

Very nice darkstar
Logged

raidenxtribe

  • Hacker
  • ***
  • Posts: 89
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #16 on: September 01, 2009, 04:26:02 PM »

Way more reasonable than the olimex cost ...
Logged

DarkstarTM

  • Member
  • **
  • Posts: 45
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #17 on: September 01, 2009, 05:09:21 PM »

DarkstarTM, would a 10MHz or 16MHz Resonator work instead of the listed 12MHz? Reason that I ask is because I can't get a 12MHz.

It will work. You will need to change a fuse. The resonator is just the reference for a PLL with 96 MHz that drives the USB. CPU runs at half that speed.

Possible external clock speeds are 48, 40, 24, 20, 16, 12, 8 and 4 MHz. Read http://ww1.microchip.com/downloads/en/DeviceDoc/39632D.pdf, pages 31 and 32 for details on how you need to set the fuses of the device then.
Logged

DarkstarTM

  • Member
  • **
  • Posts: 45
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #18 on: September 01, 2009, 05:12:42 PM »

Yup...
http://www.obdev.at/products/vusb/index-de.html

I don't know how fast this stuff will be. I never transmitted that much data with this stack :(

Pretty slow. It's low speed USB only and the interrupts from the USB will slow down your SPI code, too.
Logged

DarkstarTM

  • Member
  • **
  • Posts: 45
    • View Profile
Re: USB SPI Flasher with PIC18F2455
« Reply #19 on: September 01, 2009, 05:22:17 PM »

only one request is it poss, to use a PIC 16C745 [...]

No, sorry.

1) From the datasheet: "The PIC16C745/765 USB peripheral module supports Low Speed control and interrupt (IN and OUT) transfers only. The implementation supports 3 endpoint numbers (0, 1, 2) for a total of 6 endpoints.". Low speed is too low.

2) The device has only 256 Bytes of RAM. I need to hold at least one flash block (thats 528 Bytes) in there.

3) I would have to buy a UV lamp for development.  :o


Logged
 
 

Powered by MySQL Powered by PHP SMF 2.0.11 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM