development firmware from SD to SPI has problems reading SD card

Designing hardware that use VLSI Solution's devices as the system controller for the entire design.
Post Reply
Rogier74
User
Posts: 7
Joined: Fri 2021-09-10 15:31

development firmware from SD to SPI has problems reading SD card

Post by Rogier74 »

Hello,

I developed firmware using VSIDE for VS1010D that is working fine when booted from SD card. It plays the WAV files that are on the root of the SD card, this is drive D:. I thought I was already ready to deliver 300 pcs to the client.

I managed to move the DLX file and patch file to the \sys map op the SPI eeprom. And config.txt in the root of it.

When I boot with a SD card with only wav files on it (it says RenLevel 15), it runs the firmware well (I can see things happening in the console UART).
But when it wants to access the D: drive for playing existing WAV files, then the errors via UART will come:

It does random things, like:
- it keeps rebooting, or
- it says: 'X[0]Corrupted'
- it says : 'ZeroPtrCall: 0xa014, object may be 0x8be2 ().'
- it says : 'X:0 Corrupt (004a) at 9e80, was still ok at 8db4, lr0=80f7.'
- it says: 'ZeroPtrCall: 0x0000, object may be 0x00fe (NUL).'
- it says: '1.WAV : Not Riff WAV!' (is interesting because, this is a file on the sd card, only happenend once)

What is happening? The firmware is derived from TreePlayer as a starting point. Not much is changed, except some uart settings.
It has to be something in its code. Although 'D:' is mentioned there...

I rather not want to have the SYS map and DLX on the sd card when shipping.... That works, but not if client ever changes the SD card.

Regards,
Rogier.


edit: It works now... I tried to add some debug text over the UART, and it seems that simple subroutine calls didnt work. I mean the text dind come through the uart, so I added some delays after each printf... Those strategic delays helped somehow to find the tracks etc... I did not dig into it. Didn't have the time because I have to roll out the products...
Rogier74
User
Posts: 7
Joined: Fri 2021-09-10 15:31

Re: development firmware from SD to SPI has problems reading SD card

Post by Rogier74 »

I still have problems....
Random problems...
My hardware is based on the MiniDemo board, same brand SPI eeprom etc...

In root folder of the eeprom I have config.txt with:

Code: Select all

[?]
TP3
and in the folder SYS have:
Patch10C.dlx (I'm using the VS1010D btw...)
TP3.dlx (My application)

In the SD card I have 5 WAV files, 1.WAV, 2. WAV etc...

When I power up the application doesm't start (otherwise it would say something by the UART0, but instead it's this:
C#0d1d
VS1010D VSOS 4.20
Files:6. Buffers:3.
Runlevel 15
SPIF:c214, 2048K
SD:1915 MiB

E'Bad libfile TP3'
Not found: TP3
1.WAV
and its playing 1.WAV from the sd card (by internal player I guess). But not controlled by my application!!

- Why isn't TP3 found??


I have 50 pcs circuit board, only he first one seems to work ok-ish...
I tried also full formatting (instead of quick format), capitals... Is other patchfiles needed? BOOT.DLX???
Hannu
Senior User
Posts: 264
Joined: Mon 2016-05-30 11:54

Re: development firmware from SD to SPI has problems reading SD card

Post by Hannu »

Hi!

This looks like good old SPI flash write problem.

First get the correct boot.dlx patch for VS1010D:
viewtopic.php?f=15&t=2620
  1. Boot to runlevel 4 and clear the SPI flash. so that on next boot SD-card becomes S: drive.
  2. Boot runlevel 2 or 14 and place the boot.dlx to the root of the SD-card.
  3. Reboot again to runlevel 4 and the patch is executed from SD-card and the SPI flash writing is patched.
  4. Reformat the SPI flash. The current format is probably broken.
  5. Install your software to sys and boot.dlx to the root of the SPI flash. SPI writing should work as long as the boot.dlx is in the root of your SPI flash.
The procedure is a bit inconvenient as installing the patch requires writing to SPI flash which it is fixing.
Rogier74
User
Posts: 7
Joined: Fri 2021-09-10 15:31

Re: development firmware from SD to SPI has problems reading SD card

Post by Rogier74 »

You are amazing, it works... 2nd PCB is ok now, still 298 to go!

I don't know why the first one was ok. The TH components of that one were soldered by hand, so we suspected the remaining solder flux of the wave solder for the other 299 pcs. But for now it's ok!

Thanks for your prompt reply. Much appreciated!!

edit: in the end all PCBs work fine without any issues!!
Last edited by Rogier74 on Thu 2021-10-14 17:00, edited 1 time in total.
Hannu
Senior User
Posts: 264
Joined: Mon 2016-05-30 11:54

Re: development firmware from SD to SPI has problems reading SD card

Post by Hannu »

When you have one golden sample working you can make your life easier.

If your all boards have identical SPI flash content, have a look at flshtool. It can create image from flash and it can also write them to flash. You are mostly interested in filesystem area.

SD-card and proper config.txt you can plug in headphones and UART, play r:hello.mp3, flash the SPI flash with flshtool and after that reboot 4. SD-card, headphones and UART connector and USB connector just got tested and device programmed.
Post Reply