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

New to XMOS and XCore? Get started here.
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm

Post by Bianco »

williamk wrote: I wonder if I could come up with a simple way to flash the external SPI chips, but I will figure this one out.
Thanks again. Wk
The xflash application from XMOS can take care of writing the SPI flash connected to the default SPI boot pins (and perhaps also non-default configurations). It creates a small SPI flasher program that will run on your XMOS chip to write to the SPI flash and this program is loaded through JTAG.


User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm

Post by Bianco »

williamk wrote: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
This would require a bootloader in the OTP that talks USB. This is certainly not easy to achieve for a beginner.
And not in the last place because of the tiny chip package that the USB PHY comes in which you can't reliably handsolder in larger numbers.

A faster way to get results is using an FTDI chip as interface to the computer instead of an XTAG2 debug adapter (just like an XC-1A and even the Arduino you are familiar with). The only downside to this is the added costs for the FTDI chip.
User avatar
williamk
Experienced Member
Posts: 114
Joined: Fri Oct 01, 2010 7:47 pm

Post by williamk »

Quick question, is the following SPI Flash doable for the XMOS chip auto-boot-from-external-flash? ;-) Txs.

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

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, I'm wondering on an Arduino + XMOS combination. ;-) Check the following idea I just presented at the Arduino Audio Forum:

http://arduino.cc/forum/index.php/topic,72803.0.html

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 »

Another question. When you are using the external SPI Flash, does the XMOS chip load the entire program to SRAM then run or it runs from the SPI Flash? I need to know this, so I know how much free RAM I actually get. (I'm too used to AVRs which runs from flash, so SRAM is free for variables, not program)

Sorry for so many questions, but I think too much and I like to research things before I jump into a project. ;-)

Thank you so much for all the help so far!

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

Post by Bianco »

williamk wrote:Another question. When you are using the external SPI Flash, does the XMOS chip load the entire program to SRAM then run or it runs from the SPI Flash? I need to know this, so I know how much free RAM I actually get. (I'm too used to AVRs which runs from flash, so SRAM is free for variables, not program)

Sorry for so many questions, but I think too much and I like to research things before I jump into a project. ;-)

Thank you so much for all the help so far!

Best Regards, WilliamK
The program runs from SRAM so yes it takes space.
Flash memory in general is way too slow to keep up with an XMOS processor.
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm

Post by Bianco »

williamk wrote:Quick question, is the following SPI Flash doable for the XMOS chip auto-boot-from-external-flash? ;-) Txs.

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

Wk
That's a rather large flash chip you got there (for a very decent price).
I doubt it is supported out of the box. You will problably need to write your own flash description file for the xflash tool. See chapter 10 of the Tools User Guide
User avatar
phalt
Respected Member
Posts: 298
Joined: Thu May 12, 2011 11:14 am

Post by phalt »

A few people have proposed xmos and arduino collaborations before, but I've personally never seen anything more than speculations and ideas.

Just checked your post on arduino: looks like you've got some interesting ideas!

What is your final goal? Something to do with audio?

If there is anything we can do to help at xmos give me a shout
User avatar
williamk
Experienced Member
Posts: 114
Joined: Fri Oct 01, 2010 7:47 pm

Post by williamk »

Biano, thank you for been patient with me, of course SPI Flash wouldn't cope with a 100 Mhz clock. :oops: I'm still in AVR mode, I will get into XMOS mode pretty soon. :ugeek:

Yes, I will need help, as I'm thinking on a Medium/Large project for Beat707.com. Can't say much yet, but in a few days or weeks I should be able to do so.

Right now I was hoping to do know if this would be possible: a single PCB board with ATmega328 which will handle UART/MIDI Input/Output, Buttons, LEDs and LCD interface. This chip will talk to a XMOS chip which will handle heavy math and then report back to the ATmega328. I'm hoping to add a very easy to handle 16-bit DAC to the thing, or at least 12-bit DAC, but 16-bit would make more sense, but I couldn't find any on eBay. And yes, I need to be able to get things on eBay for now, as I'm Brazil, and most of those big-as* companies charges me $ 40 USD to send me anything, that sucks.

Then I need to come up with a tool that will flash the SPI Flash without using the XMOS XTAG interface, so a XTAG programmer wouldn't be required, but still optional and usable.

So the idea is rather simple: USB -> FTDI -> ATmega328 -> SPI FLASH -> XMOS - some sort of switch or transistor/gate would allow the XMOS chip to be bypass so the ATmega328 can flash the chip, then disable the ATmega328 connection to the SPI Flash so the XMOS can use it. Not sure if that's possible yet.

Thank you all again for all the help, I will need tons of help if this will turn into a reality. ;-)

Best Regards, WilliamK
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 just had a very strange idea, couldn't the ATmega328 serve as a SPI Flash during the XMOS chip boot process? Then after that's done it would carry with the other operations. The ATmega328 has only 32K of Flash, but if all the XMOS chip will do is Math processing, without much variables, I would think that, lets say, 16K would be enough. In any event, we could always use the ATmega1280 which has 256K of Flash, then its all good, as the XMOS chip has only 64K of free space for the program+variables anyway.

Not sure how the electronics would look. The ATmega code would have to work as a SPI Slave device during startup, which is easy to do, then after X number of bytes is read, it goes into normal mode and disables SPI, OR, the SPI could them be used to talk to each chip.

Well, I'm totally crazy, so bear with me on all this... :mrgreen: :geek: :ugeek:

In order to run some tests I guess I need to build a simple board that has only the XL1 chip, the regulators, Oscillator, all connected to a SPI header which would then connect to the ATmega chip.

The only problem, which should be easy to solve, is that the ATmega has a delay once it powers up, for the bootloader. But them, a pin on the ATmega could be used to power the XMOS chip via a transistor or whatever. So, the ATmega powers up, enter SPI mode and then fires up the XMOS chip via this output pin/selector. Makes sense?

Also, it would be fun to see an Arduino Shield which has a XMOS chip on it using the power from the Arduino 5V and 3.3V+, which should work on the XMOS, right? And have the XMOS connected to the Arduino as an SPI device. The Arduino program would then take care of talking to each other.

All that would be required is a small Processing program that would convert a XMOS binary data to a C code the Arduino IDE could load and use as the SPI "memory".

Thinking on the whole thing again, this could work, right? And would make a bridge between the Arduino community and the XMOS community, which would be nice.

I, for instance, would love to have the ATmega chip handle all the SPI/UART/2IC/ADC/DAC and have the XMOS just for math. I know that there are better alternatives for that, but none as friendly as XMOS. :mrgreen:

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