Starting up... again... how to program blank chips?

New to XMOS and XCore? Get started here.
User avatar
williamk
Experienced Member
Posts: 114
Joined: Fri Oct 01, 2010 7:47 pm

Starting up... again... how to program blank chips?

Post by williamk »

Ok, here's the deal, I have some background on Arduino/AVRs, so I'm wondering on passing this along the XMOS family now. ;-)

I have the XC1A kit, which works nicely.

If I get a black chip, like this one:

http://www.sparkfun.com/products/10109

Can I use the XC1A kit to program this chip? How?

What extra components I will need?

Is it possible to boot the chip from a firmware stored on a SD Card? How?

Thank you.

Best Regards, WilliamK


Wusik Dot Com (http://www.Wusik.com)
William-K.com (http://www.William-K.com)
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm
Contact:

Post by Bianco »

Hi William,

The XC1A is not intended to program other targets.
Your best option is to buy an XTAG2 debug adapter.
It can be bought at sparkfun.
There has been a price reduction on the XTAG2 ($19 now), i see that sparkfun has not reduced the price (yet).
If you have access to digikey, you can buy it there for $19

As support circuitry you will need some capacitors for buffering and decoupling and the PLL filter (10uF and 100nF ones and 1uF with a 4.7 ohm resistor for the PLL filter), 3.3V and 1.0V power supply regulators (don't forget power supply sequencing!), a power-on-reset controller, SPI Flash and perhaps some buffer IC's for the JTAG lines (From my experience this is not really necessary for single node systems). Also you will need a header/connector to connect the XTAG2.

I suggest to take a look at the many examples such as the XMOS XK-1A kit, the sparkfun board and the minimal L1 example from XMOS. I also strongly recommend to read the Hardware Design Checklist

An XMOS chip cannot boot from an SD card by default. However, tt is possible to write a custom bootloader that can be burned into the One-Time-Programmable memory.
User avatar
williamk
Experienced Member
Posts: 114
Joined: Fri Oct 01, 2010 7:47 pm

Post by williamk »

Thanks for the info.

Some other questions.

1) the One-Time-Programmable memory, is it like write-once, and can't erase write again?

2) does a blank chip already come programed to boot from the SPI, or is that why I need the XTAG2 adapter, to program that and the SPI?

I would like to point out that for beginners, it should be an easy way to handle XMOS chips, that would open a whole new market on low-end DIY dummies like me. ;-) Maybe an XMOS Lite IDE with an easier XMOS PCB Kit? Just an idea. ;-)

Txs again.
Wusik Dot Com (http://www.Wusik.com)
William-K.com (http://www.William-K.com)
MaxFlashrom
Experienced Member
Posts: 82
Joined: Fri Nov 05, 2010 2:59 pm

Post by MaxFlashrom »

williamk wrote:Thanks for the info.

Some other questions.

1) the One-Time-Programmable memory, is it like write-once, and can't erase write again?

2) does a blank chip already come programed to boot from the SPI, or is that why I need the XTAG2 adapter, to program that and the SPI?

I would like to point out that for beginners, it should be an easy way to handle XMOS chips, that would open a whole new market on low-end DIY dummies like me. ;-) Maybe an XMOS Lite IDE with an easier XMOS PCB Kit? Just an idea. ;-)

Txs again.
William, yes, the One-Time-Programmable memory can only be written once - it's in the name!
It may be possible to write only part of it, as flash memories usually read as 0xff when blank. I've not checked to see how the Xcore OTP reads when blank. This is unlikely to help you, though(see below)

The XMOS OTP is 8K bytes so is only suitable for a small program. Many designs may not ever use it.

Blank XMOS chips can be configured to boot from an external SPI flash device by wiring the boot mode pins appropriately, not requiring any other programming.

The XMOS XTAG2 is very reasonably priced now at $19 on Digikey rather than $50 on Sparkfun.

You will need to have a programmer of some sort to program your blank SPI flash, and the XTAG2 is as cheap as any.
The XTAG2 also allows you to load programs into the internal RAM memory of the XMOS chip for testing(via JTAG) This does not require writing to a flash device. This is very handy as it means you only need to write the flash device later when you've tested your code and got it right.

You are well advised to purchase a development board XMOS/Sparkfun. The beginner is unlikely to make much progress purchasing just a blank chip on no board. The XTAG2 can be bought paired with a development board.

Old hacker's note:
Programming flash memory bytes as 0xff means that those bytes can be rewritten at a later time with any value.
Previously used bytes are removed by using a NOP Opcode. This is one of the reasons why many microprocessors used to assign the opcode 0x00 or 0x0000 or 0x00000000, as appropraite, to the NOP - no-operation CPU opcode.

It is most unfortunate that on the XMOS architecture the opcode 0x0000 codes for

Code: Select all

 stw (2rus) r0,r0[0x0]
The value of register r0 after power-up will either be 0x00000000 or undefined on CPU power-up.
This means that execution of the stw (2rus) r0,r0[0x0] instruction will cause a runtime ET_LOAD_STORE exception, meaning this favourite hackers' scheme will fail on the XMOS OTP.

I employed this trick way back when EPROMs with windows had to be zapped in a UV box taking about 10 minutes and came in Intel 2764 8K sizes(a bit like the XMOS OTP, in fact). Blank EEPROMs also read as 0xff.

Max.
User avatar
williamk
Experienced Member
Posts: 114
Joined: Fri Oct 01, 2010 7:47 pm

Post by williamk »

Thank you for the extra details. I will go slowly on this. ;-)

A question, is the SparkFun chip a Blank chip, or it comes with a bootloader for the SPI Flash? ttp://www.sparkfun.com/products/10109 - in any event, the XTAG2 adapter will write the OTP memory and make the chip ready, right? (just confirming, sorry to ask this over and over)

I just don't get why I can't use the XCA1 XTAG2 adapter to handle new chips, but, what do I know? :ugeek:

I'm still experimenting with the whole thing, trying to handle things out...

Wk
Wusik Dot Com (http://www.Wusik.com)
William-K.com (http://www.William-K.com)
User avatar
williamk
Experienced Member
Posts: 114
Joined: Fri Oct 01, 2010 7:47 pm

Post by williamk »

Also, since I plan to invest a lot on this XMOS chip, I wonder, how reliable is the XMOS company? Sorry to ask, but I need to know, as most electronic aficionado haven't got the XMOS bug yet, so I wonder if its just me? :lol: :mrgreen: :geek: :ugeek: I love the chip, but I also love AVRs for simple things. Still, I'm trying to imagine some musical usage for my XC1A kit...

Wk
Wusik Dot Com (http://www.Wusik.com)
William-K.com (http://www.William-K.com)
MaxFlashrom
Experienced Member
Posts: 82
Joined: Fri Nov 05, 2010 2:59 pm

Post by MaxFlashrom »

williamk wrote:Thank you for the extra details. I will go slowly on this. ;-)

A question, is the SparkFun chip a Blank chip, or it comes with a bootloader for the SPI Flash? ttp://www.sparkfun.com/products/10109 -
Yes, William, the OTP of that chip is blank.
You do not need to do anything to a blank XMOS chip to boot from an external flash chip. You just wire the mode pins right.

As I said before:
Blank XMOS chips can be configured to boot from an external SPI flash device by wiring the boot mode pins appropriately, not requiring any other programming.
As well as the OTP ROM there is a non-programmable ROM in the chip that allows it to boot from an external SPI Flash chip if one wires the mode pins right.
williamk wrote: in any event, the XTAG2 adapter will write the OTP memory and make the chip ready, right? (just confirming, sorry to ask this over and over)
Forget about the OTP: it is making you confused! When you understand a lot more about the chip then you might want to worry about it. If you write the OTP you can not boot from SPI unless the OTP program does this.
williamk wrote: I just don't get why I can't use the XCA1 XTAG2 adapter to handle new chips, but, what do I know? :ugeek:

I'm still experimenting with the whole thing, trying to handle things out...
The XC-1A is different from the XTAG2. It works differently. It includes a FTDI chip which does the USB. This works differently from the XTAG2. Yes, if you are experienced, you could use the XC-1A to talk to other XMOS chips via JTAG or XMOS XLinks. You could also make it program SPI Flash chips. You would have to write all this yourself.

Hope this helps a bit.
Max.
MaxFlashrom
Experienced Member
Posts: 82
Joined: Fri Nov 05, 2010 2:59 pm

Post by MaxFlashrom »

williamk wrote:Also, since I plan to invest a lot on this XMOS chip, I wonder, how reliable is the XMOS company? Sorry to ask, but I need to know, as most electronic aficionado haven't got the XMOS bug yet, so I wonder if its just me? :lol: :mrgreen: :geek: :ugeek: I love the chip, but I also love AVRs for simple things. Still, I'm trying to imagine some musical usage for my XC1A kit...

Wk
William, if the chip works now and does what it's supposed to why care how long XMOS will continue to exist? How many million chips are you going to buy from them then? If you're in that league I'm sure you'll be able to help stop XMOS going bankrupt! Have confidence in yourself. If you like what you see, and it works for you, use it. If you need the opinion of many fans over many years, stick to Arduinos and the 8051.

Max.
User avatar
williamk
Experienced Member
Posts: 114
Joined: Fri Oct 01, 2010 7:47 pm

Post by williamk »

Thanks for the care, specially with such stupid questions, sorry. :oops: :oops: :oops:

I will read more docs, so far I read the programming in XC many many many times. ;-) I have it in print.

I wonder if I could come up with a simple way to flash the external SPI chips, but I will figure this one out.

I plan on doing some nice experiments with my XC1A kit soon. ;-)

Thanks again. Wk
Wusik Dot Com (http://www.Wusik.com)
William-K.com (http://www.William-K.com)
User avatar
williamk
Experienced Member
Posts: 114
Joined: Fri Oct 01, 2010 7:47 pm

Post by williamk »

I'm all set up now.

BTW: now, this will sound stupid, but bear with me. what if there would be a small board with USB connection and the simplest XMOS chip + SPI Flash. Them, instead of the XTAG2 connector, the USB would reset the XMOS, flash the SPI Flash, and reset the chip again. If this would be a cheaper board, this would be great, as I could do all sorts of open-source stuff for it, and users could get the board for the software I make. ;-) Currently, the cheapest options are still over $ 60 USD for a complete thing. I guess I'm just dreaming?

Wk
Wusik Dot Com (http://www.Wusik.com)
William-K.com (http://www.William-K.com)
Post Reply