cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
politoleo
Visitor
Visitor
10,358 Views
Registered: ‎05-30-2012

Programming FPGA's spi flash with microcontroller

Hi, this is my first post on this forum!


In our company we used an FPGA for high speed data acquisition for the first time, we are about to relase the product, so we need to insert a "bootloader" for let our client do upgrades in future.

 

The fpga boot with a SPI Flash memory, witch is connected also with the microcontroller (tristated pin)!

 

My question is:


How can i stream the MCS file onto the spi flash? 

 

I mean, i know how to program the flash with mcu, but i need something readable  by the mcu, and i don't know anything about MCS file format, or what sector i need to program on the flash.

 

I've found this: 

http://www.xilinx.com/support/documentation/application_notes/xapp058.pdf

 

but i think my situation is different, i don't want to go trough the fpga to program the flash (the board is already done, so i just can't do it)

 

Sorry in advance if this would be a stupid question! 

0 Kudos
Reply
7 Replies
eteam00
Instructor
Instructor
10,354 Views
Registered: ‎07-21-2009

i don't know anything about MCS file format, or what sector i need to program on the flash.

 

When you use the Xilinx search tool to find "mcs file format", AR #476 shows up first in the list.

 

-- Bob Elkind

SIGNATURE:
README for newbies is here: http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

Summary:
1. Read the manual or user guide. Have you read the manual? Can you find the manual?
2. Search the forums (and search the web) for similar topics.
3. Do not post the same question on multiple forums.
4. Do not post a new topic or question on someone else's thread, start a new thread!
5. Students: Copying code is not the same as learning to design.
6 "It does not work" is not a question which can be answered. Provide useful details (with webpage, datasheet links, please).
7. You are not charged extra fees for comments in your code.
8. I am not paid for forum posts. If I write a good post, then I have been good for nothing.
politoleo
Visitor
Visitor
10,350 Views
Registered: ‎05-30-2012

Thank you very much for the fast reply!

 

It's so simple?

 

I just need to program the flash with the hex generated  by this command "promgen -p hex -r input.mcs -o output.hex" and that's all? 

0 Kudos
Reply
eteam00
Instructor
Instructor
10,335 Views
Registered: ‎07-21-2009

It's so simple?

 

Here's an experiment that everyone needs to try at least once in their careers:

  • Use iMPACT to erase and program the SPI flash memory
  • Have the uController decode the .MCS file and compare the decoded binary with the SPI flash memory contents

This helps sort out lingering questions with

  • bit ordering
  • start address
  • preamble
  • post-amble
  • etc. etc.

-- Bob Elkind

SIGNATURE:
README for newbies is here: http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

Summary:
1. Read the manual or user guide. Have you read the manual? Can you find the manual?
2. Search the forums (and search the web) for similar topics.
3. Do not post the same question on multiple forums.
4. Do not post a new topic or question on someone else's thread, start a new thread!
5. Students: Copying code is not the same as learning to design.
6 "It does not work" is not a question which can be answered. Provide useful details (with webpage, datasheet links, please).
7. You are not charged extra fees for comments in your code.
8. I am not paid for forum posts. If I write a good post, then I have been good for nothing.
0 Kudos
Reply
politoleo
Visitor
Visitor
10,318 Views
Registered: ‎05-30-2012

Ok, i've done the first step hundred time, so i know the pcb and the flash works!

 

Now i will do the same with the mcu, if i'll have some problem I'll post it here!

Thank you!

 

0 Kudos
Reply
amin_8460
Visitor
Visitor
9,447 Views
Registered: ‎11-27-2012

Hi politoleo

I intend to program spi flash using uController as you mentioned. could you please help me to do it if you succeeded in?

I want to know that which part of MCS file should be written in SPI flash and in what order?

 

thnaks,

Amin

0 Kudos
Reply
amin_8460
Visitor
Visitor
9,385 Views
Registered: ‎11-27-2012

Hi

That was simple. I did it.

Thanks

0 Kudos
Reply
bareil76
Explorer
Explorer
6,772 Views
Registered: ‎07-04-2014

I just had the same problem but the previous comment did not help me a lot. I found a solution and will post it here for other to benefit from it.

 

1) Keep the INI_B low on reset to prevent the FPGA from getting control of the SPI pins. (this way, it will work even if FPGA is in master mode)

2) Program the .mcs file to the FPGA with the correct memory addresses.

 

See the comment from on page 1 on this thread to get the correct addresses. It will explain where to place the data on the SPI chip. Also, .mcs files are nice because the CRC is already calculated.

 

I read the PROM and compared it with the .mcs file and it corresponds to the thread above.

 

 

0 Kudos
Reply