Page 1 of 1
FC8 wave player fat on pic32 not writing to disk
Posted: Thu Aug 16, 2018 8:06 am
by stefan.erni
Hi Ben
Thats a very nice component this waveplayer,easy to understand and easy to use.
But still I did not make it.
I tested the hardware I can write to the disk with the component fat. I also have a Led in the Macro TimerInt, it flashes.
and the connection to the fat looks ok.
The chipcard is empty, even if I look at it with a disk editor
(link to a free disk editor)
https://mh-nexus.de/en/hxd/
https://www.matrixtsl.com/wiki/index.ph ... _(Storage)
Re: FC8 wave player fat on pic32 not writing to disk
Posted: Thu Aug 16, 2018 11:11 am
by Benj
Hello and many thanks, glad you like the component.
Please can you attach your project file to the forums and I'll take a look through for you at what might be going wrong.
Re: FC8 wave player fat on pic32 not writing to disk
Posted: Thu Aug 16, 2018 1:09 pm
by stefan.erni
Hi Ben
Thanks Ben here the program a little smaller, so it is easier.
The 5second delay is just to prevent the program from starting during the pic flush
Re: FC8 wave player fat on pic32 not writing to disk
Posted: Fri Aug 17, 2018 4:08 pm
by Benj
Hello,
It could be the size of the buffer combined with the length of the delay in the loop that is causing you problems.
You have a sample rate of 8K and a bit depth of 16-bit. In your loop you have a delay of 100ms in between processing the buffer.
8000 * 2 bytes * 0.1s = 1600 bytes that will accumulate during the 100ms delay but your WAV buffer is only 512 bytes.
Hopefully this should let you tweak things to allow you to get further and get the component working. Ideally you want plenty of RAM assigned to the WAV buffer so you can cope with any delays and any further delays imposed by accessing the FAT file system on the card inside the ProcessBuffer macro.
The ProcessBuffer macro does have a return variable so you can more easily see if a buffer overrun event has happened during recording or playback.
You also probably need to call the StopRecording function after the Timer interrupt disable icon if you want the file to end.
Let me know if your still having problems and I'll investigate further for you.
Re: FC8 wave player fat on pic32 not writing to disk
Posted: Fri Aug 17, 2018 4:46 pm
by stefan.erni
Hi Ben
I reduced the delay and made the buffer biger and put the stop recording.
still empty disk.... not even a file header...
Re: FC8 wave player fat on pic32 not writing to disk
Posted: Fri Aug 17, 2018 4:50 pm
by Benj
Ok thanks, I'll double check that nothing's gone wrong with the macro re-directs i.e. the bit that allows the WAV component to take control of the FAT component.
Re: FC8 wave player fat on pic32 not writing to disk
Posted: Mon Aug 20, 2018 10:23 am
by Benj
Hello,
I've been back through the component and found out the re-directs were not working correctly. I have now fixed these and double checked they are generating the correct code.
I've pushed the changes to the update system now so hopefully these should solve the problems you're having.
Re: FC8 wave player fat on pic32 not writing to disk
Posted: Mon Aug 20, 2018 11:17 am
by stefan.erni
Thank you Ben
I tried it and now data is written on the disk. But not as a wave file. I can not delete the data anymore. I have to format the card. But I think we are close to the solution.
Re: FC8 wave player fat on pic32 not writing to disk
Posted: Mon Aug 20, 2018 12:25 pm
by Benj
Hello,
Many thanks for getting back so quickly. I have had another go at the component and pushed the change to the update system, hopefully this should now fix the issue for you.
Let me know how you get on.
Re: FC8 wave player fat on pic32 not writing to disk
Posted: Mon Aug 20, 2018 1:22 pm
by stefan.erni
Hi Ben
Perfect. It's working now. Thank you for the help.
Stefan