Dangerous Prototypes

Other projects => Past projects => CPLD programmable logic => Topic started by: samira on April 29, 2011, 03:34:47 pm

Title: Programming CPLD with Bus Pirate?
Post by: samira on April 29, 2011, 03:34:47 pm
Hi all :

I finally got my bus pirate v3b ( Jan2010 ) and XC9572 XL
( It took ~13 days to arrive )

My goal is to learn CPLD, therefore BPv3b is going to be used primarily ( as of now ) as programmer for the XC9672 board ( FPGA and CPLD programming) .

I performed hardware self test via terminal : passed.

Bus Pirate v3b
Firmware v5.10 (r559)  Bootloader v4.4
DEVID:0x0447 REVID:0x3043 (24FJ64GA002 B5)
http://dangerousprototypes.com (http://dangerousprototypes.com)

As a stand-alone XSVF player to program CPLD/FPGA, this requires a simple firmware Swap.
Question :
1 "Load alternate firmware using your normal firmware update procedure" , does this mean the original bootloader ( in BPv3b)  would be erased from BPv3 ?

2 Does "Use your favorite firmware update program to load the BPv3SXVFplayer.vx.hex" mean I have to update via programmer like 'Pickit3' ? If so, could you list or mention some programs that are commonly used for this purpose ? I am not quite clear on how to achieve this.
Specifically, how do I load the alternate firmware ( what software with what cable ) ?

Perhaps, some block program or some form of graphic representation might help newbies like me to understand the procedures and/or mechanics to accomplish what you describe in your website better.

I have been playing with AVR mega & xmega and not familiar with this CPLD at all.
My apology if these questions are so trivial.

samira
Title: Re: Programming CPLD with Bus Pirate?
Post by: ian on April 29, 2011, 03:45:51 pm
Hi samira,

I'm sorry for the confusion.

The XSVF player is loaded over USB using the Bus Pirate bootloader. No need for a programmer.

You can use the windows GUI utility (included in the CPLD download archive, along with the alternate firmware), or the multi-platform console utility (included with teh Bus Pirate firmware download).

The bootloader instructions are here, just substitute the XSVF player for the Bus Pirate firmware file:
http://dangerousprototypes.com/docs/Pir ... Windows%29 (http://dangerousprototypes.com/docs/Pirate-Loader_console_upgrade_application_%28Linux,_Mac,_Windows%29)
http://dangerousprototypes.com/docs/Ds30_Loader_GUI (http://dangerousprototypes.com/docs/Ds30_Loader_GUI)

I'll make sure all the consoles are included in the next CPLD release so it is a single download no matter the bootloader application you use.
Title: Re: Programming CPLD with Bus Pirate?
Post by: samira on April 29, 2011, 04:14:28 pm
Hi Ian :
Thanks for the prompt response.

Where can I find pirate-loader program ?
Or it is the same as "PiratePICprog.15JUN2010.zip"

Sorry to trouble you so much.

samira

PS: never mind,I found it in the zip file.
Title: Re: Programming CPLD with Bus Pirate?
Post by: ian on April 29, 2011, 04:49:01 pm
no problem, thanks for the update. I'm sorry the files are not in this distribution archive. I'll add a table with firmware and loader options to the wiki.
Title: Re: Programming CPLD with Bus Pirate?
Post by: samira on April 29, 2011, 05:23:41 pm
Hi Ian :

Please clearify this for me since I am not quite clear. Better understanding the mechanic of the process would certainly help me to better use my new BPv3 board. Please correct me if I misunderstand.

With the board I got right now, in the flash memory, there is firmware v5.10.

1 Per your explain above, when the XSVF player is loaded over USB using BP bootloader, the original firmware v5.10 is clear from the flash memory, correct ? And I presume the bootloader is still there. If so, why can't I reload firmware back using bootloader ? why do we need ds20 Loader to do this job ?

2 Therefore, when I want to put firmware v5.10 back to flash memory, I have to use ds20 Loader.
From the question #1, my impression is that bootloader is gone after XSVF player is loaded.That is why we have to use ds20 Loader to load the firmware back. Do I understand this correctly ? Or I am totally lost.

I want to be clear before undertaking the step 1 and perhaps 2 later.

I dread dealing with this flash memory in particular the fusebit ( I know not quite so in PIC as in AVR)  etc...
Being a newbie, I don't want to make a wrong move because I do not know how to correct the error later on.

Please bear with me.

Thanks.
samira
Title: Re: Programming CPLD with Bus Pirate?
Post by: ian on April 29, 2011, 06:14:49 pm
No worries,

ds30 loader/pirate-loader are the computer applications that communicate with the bootloader in the Bus Pirate.

1) Yes, we erase the old firmware in flash and load a new one. When you send the XSFVplayer firmware (with pirate-loader or ds30loader), the bootloader takes chunks of the files from the computer and programs it to the flash. The bootloader is still there. In fact, the Bus Pirate bootloader is (almost) indestructible. We write a ton of protections into it, you probably couldn't kill it if you tried :)

When you're ready to go back to the old firmware, just follow the bootloader/firmware update instructions again and send the BPv3.firmware.v5.10.hex file to the Bus Pirate. The bootloader takes the firmware and programs it into the flash just as before.

Quote
If so, why can't I reload firmware back using bootloader ? why do we need ds20 Loader to do this job ?

I'm a little confused about this question and how to answer. The ds30 loader is just the PC part that talks to the Bus Pirate bootloader over USB. You are using the bootloader to reload the firmware. The process to load either firmware (or any other firmware too) is the same.

Just give it a try :) We're here to help if anything goes wrong.
Title: Re: Programming CPLD with Bus Pirate?
Post by: samira on April 29, 2011, 07:20:48 pm
Per your advice( encouragement )  I download file "bpv3-xsvf-vb.hex" using ds30 Loader GUI.exe.
This is what I got.

(http://http://www.electoday.com/home/attachment/201104/29/25_130409734829Kk.png)

Question : How do I check or find out what is in my flash memory ( 5.1 v firmware or  bpv3-xsvf-vb.hex) ?


thanks.

nick
Title: Re: Programming CPLD with Bus Pirate?
Post by: ian on April 29, 2011, 07:43:52 pm
There's not really a way to tell. For Bus Pirate firmware you can open a terminal and view the info menu with the 'i' command.

If the bootloader says 'ok', then the XSVF player is definitely loaded.
Title: Re: Programming CPLD with Bus Pirate?
Post by: samira on May 02, 2011, 03:18:19 am
Hi Ian :
Thanks for all the helps.
I finally managed to load xsvf file to XC9572
First project ( 2 bit decoder)  passed with little problem but fixed.

Look like it is going to be a lot of fun and lot of things to study.

Thanks again.
samira
ps : Once I went through the procedure ( steps) ,  I think I am clear now with the questions I posted earlier. Evidently not seeing what needed to be done before, I was totally lost. Really appreciate your helps.
Title: Re: Programming CPLD with Bus Pirate?
Post by: samira on May 02, 2011, 08:36:39 pm
One comment I didn't plan to make but after continuous trouble I just have to make one.

I believe your choice selection of white character on yellow background ( PCB ) is not a good choice because it gives very poor contrast between character and its background. I suspect it will affect more  with aged user/s.

I have difficulty reading the pin label on the board with this yellow-colored PCB board ( need magifying glass with bright light every times ) whereas I do not have any trouble at all reading label on your bus Pirate ( white character on red background ). It is just that much different.

Just one input from one (aged)user. I hope you would use this info in your consideration for your next version.

samira
ps : White character on green background( PCB) also give a very good contrast and pleasing to the eye.
Title: Re: Programming CPLD with Bus Pirate?
Post by: ian on May 02, 2011, 09:02:05 pm
Thanks for the report samira, I'm sorry about the poor contrast.

We were using yellow for the initial batch of things, but I also do not like it. We will be using red for everything from now on.

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01032074664session_write_close ( )...(null):0
20.01062206240ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01062207016Database_MySQL->query( ).../DatabaseHandler.php:119
40.05492345736Database_MySQL->error( ).../Db-mysql.class.php:273