SPI FLASH programming by USB.

Writing software that controls the system and peripherals such as displays, SD cards, Buttons, LEDs, Serial Ports etc.
Post Reply
ed_haslam
User
Posts: 14
Joined: Wed 2023-10-25 8:00

SPI FLASH programming by USB.

Post by ed_haslam »

Hello,

We are finally moving our project into production. Could you please tell me if there's a way to program a compiled image file into SPI FLASH using a USB interface? The UART interface worked fine for development programming, it would just be a faster process if we could load program code and audio files all over USB in production. For NAND FLASH, there's quite a bit of information about doing this and some utilities but I haven't found anything specific to SPI serial FLASH chips (we're using a Macronix MX25L3233FM2I-08G).

Thank you,

Ed
User avatar
pasi
VLSI Staff
Posts: 2174
Joined: Thu 2010-07-15 16:04

Re: SPI FLASH programming by USB.

Post by pasi »

Unfortunately loading the firmware through USB is complex due to the small size of the VS1000's RAMDISK (6.5kB).

UART is the easiest. Once the firmware is there (and supports USB mass storage for the SPI FLASH), the content could be programmed through USB, although for small contents programming the firmware and content image through UART with a high UART speed (e.g. 460800 bps or higher) could be overall faster.

For the vs1000 audio module (and vs1103 module) production we program the firmware and example content through uSD by first sending a short programming routine through UART. It detects uSD card and programs firmware and content files from uSD to SPI FLASH. Having pins/pads on the board for the pins that are used for SD communication would allow you to use this kind of method.

Are you using pcflash.exe, and what are the parameters you use?
What is the size of your content?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
ed_haslam
User
Posts: 14
Joined: Wed 2023-10-25 8:00

Re: SPI FLASH programming by USB.

Post by ed_haslam »

Hello Pasi,

Thank you for your reply. Understood about the problem of limited RAMDISK space on the VS1000. When VSIDE compiles our code, the eeprom.img file ends up about 22.5K in size. So far, I haven't had success using pcflash. Programming through VSIDE's Prommer/Flasher utility has been working well. I thought about writing a GUI based version in Lazarus to take the place of the command line oriented pcflash program. However, I'm not familiar with the transfer protocol for the VS1000 and it might take quite a bit of time and experimentation with only the original C code to reference. This first run is 1,000 boards and we'll probably just load the source code with Prommer/Flasher then transfer the audio files via USB the way we have been doing. For the next batch, I think combining the files using imggen and then programming that image into the FLASH chips before board population will be the way to go.

Thanks again,

Ed
User avatar
pasi
VLSI Staff
Posts: 2174
Joined: Thu 2010-07-15 16:04

Re: SPI FLASH programming by USB.

Post by pasi »

ed_haslam wrote: Tue 2025-01-28 4:36So far, I haven't had success using pcflash. Programming through VSIDE's Prommer/Flasher utility has been working well.
pcflash connects to the vs1000 chip in the same way as the VSIDE's prommer, so the issue is probably just in the parameters.

The newest pcflash also has different erase options. Originally chip erase was performed to erase the whole SPI FLASH. Now there are two other options: "check" which checks the first 64kB to see if the FLASH looks empty, and if so skips erase to allow quicker programming of firmware on an empty SPI FLASH, and the "while" option erases 4kB blocks on the fly when programming.
ed_haslam wrote: Tue 2025-01-28 4:36I thought about writing a GUI based version in Lazarus to take the place of the command line oriented pcflash program. However, I'm not familiar with the transfer protocol for the VS1000 and it might take quite a bit of time and experimentation with only the original C code to reference.
pcflash.c is fairly short and pretty "straightforward".
[*] sends a "jump to monitor" command 0xef to UART at 115200bps. If it receives the correct reply (0xfe), connection is established
[*] writes erasemode and uart speed to specific addresses using the emulator communication protocol
[*] then sends and runs the prommer using the emulator protocol (from autoprogimg.h)
[*] changes UART speed (if something else than 115200bps was defined)
[*] from this on, talks with the prommer -- waits for responses for size and chip erase result, sends blocks to program, etc.

There is some code in pcflash.h for the VS1000 VoiceMail software you can just throw out.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Post Reply