|
|
View previous topic :: View next topic |
Author |
Message |
acsg
Joined: 25 Apr 2021 Posts: 8 Location: Rio de Janeiro - Brazil
|
Copy fat files from WEBserver to Pic over internet |
Posted: Sun Apr 25, 2021 12:07 pm |
|
|
Hi Guys,
I have home-made web server Pic 18f97j60 + flash eexternal memory.{like PicDem}
I need copy short audio .wav files {fat 16} from PC server over the internet to store in my PicDem flash memory {fat 16}.
First,how i format my flash memory to fat16?
Then, how method maybe i use?
1- HTTP?
2- FTP?
3- TFTP?
4- MPFS?
Ist very important for work now. I use CCS 5.059
Regards all. _________________ "For by wise counsel you will wage your own war."
Pv24:6 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Mon Apr 26, 2021 2:28 am |
|
|
First, why on earth would you want to format the memory using FAT16?.
Involves you in having to have all the extra code to handle this, and unless
you want the memory to be unplug-able from the PIC and then read using a
PC, 'pointless. Just KISS, and have your own basic allocation that knows
what the data is called how large it is, and where it is stored in the memory.
FAT, involves wasting space in the memory, and a lot more code. Pointless.
TFTP, is potentially less work than FTP, and provided the transfers are in
one direction only, could be a good way to go.
MPFS is a file format, not a transfer protocol.
FTP would normally be the standard way to transfer such files.
HTTP adds another layer of complexity. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Mon Apr 26, 2021 5:13 am |
|
|
The only reason I can see to store the audio data as WAV file in FAT16 format, is that you have some kind of audio playback feature in your PIC project that REQUIRES the file in a specific format. Something you don't say in your original question.
As Mr. T points out, simply use FTP to send the file to the PIC and store it, byte by byte.if the short WAV file is say 8234 bytes, that's all the bytes you need to save a 'copy' of it. Hmm, a few more (8+) for a 'filename'.
I'd break down the project into 2 sections though.
1st, using 'RS-232' ( really PC <>USB<>PIC ), create code to receive and store a 'file' from the PC. Obviously there are timing issues to deal with.Use a 'terminal program' to send the 'wav' file. As a test, I'd send the stored WAV file BACK to the PC and confirm it's 100% correct.
Once this works, THEN cut code for the FTP/webserver/ ?? method of getting code from PC to PIC.
While 'simple' in concept, there are lots of potential problems to deal with, so breaking down the program into smaller tasks, that CAN be verified to work, really helps save time ,especially in debugging code ! |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
Re: Copy fat files from WEBserver to Pic over internet |
Posted: Mon Apr 26, 2021 6:34 pm |
|
|
acsg wrote: | Hi Guys,
I have home-made web server Pic 18f97j60 + flash eexternal memory.{like PicDem}
I need copy short audio .wav files {fat 16} from PC server over the internet to store in my PicDem flash memory {fat 16}.
First,how i format my flash memory to fat16?
Then, how method maybe i use?
1- HTTP?
2- FTP?
3- TFTP?
4- MPFS?
Ist very important for work now. I use CCS 5.059
Regards all. |
I've done all this before using the PIC18F97J60 and an external FLASH with the microchip TCPIP stack and MPFS2.
And, there's a Microchip utility to help you.
You would roll up all your web pages into a single folder and then you point the MPFS2 utility to that folder and it makes a .BIN file.
This gets stored by a handler in the PIC via a POST operation to a URL that takes the file name and has an "upload" button. ( http://<host addr>/mpfsupload )
Then you can store whatever you want up to the size of the storage device. _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
acsg
Joined: 25 Apr 2021 Posts: 8 Location: Rio de Janeiro - Brazil
|
|
Posted: Tue Apr 27, 2021 5:48 am |
|
|
Hi guys, thanks for your quick reply,
{I am analyzing each answer, and I will also give an appropriate reply for each one}.
I have a speech announcer to be located far , install a higher place,out of my reach.
The stand alone device that speak msg alerts the times em times .
It is a Device (chinese) that stores wav files in a flash eeprom 25q64 by usb cable.
Well, it’s impractical to update msg by cable,
Then i design that follow solution:
1- Implement a Pic 18f97j60 with CCS stack tcp/ip + FTP/TFTP to receive wav files by wi-fi and
store in a fat 16 SPI Flash memory.
2- By a VCNL1 USBMaster functionality (VDAP) ,it is possible to use 2 USB ports.
- Slave Chinese USB device in Port 1
- Pic18f MCU like BOMS-Flash-Disk in Port 2
3- By VCNL1 DOS command, copy .wavs from one to the other.
4- After that, device announcer would be updated.
That's what i thought but i'm accepting suggestions from you {kings of the bits}.
Thanks, _________________ "For by wise counsel you will wage your own war."
Pv24:6 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Tue Apr 27, 2021 9:27 am |
|
|
Simplify.
You don't need 3/4 of what you are describing. Add an external RAM to
the processor. Say perhaps 64KB or more. Perhaps something like a
23LC1024.
Then simply download from the network to this. Quick, no delays for
writes etc...
Once you have successfully downloaded the file, simply use a Vinculum
to talk to the sound device and write the file to it.
At no point does the PIC have to access a 'filesystem' as such.
You can check the data is received OK, before you write to the device.
Similarly you can test each part of the software separately. Get reads and
writes to the SRAM working as one item. Then get sending data from this
to the Vinculum. Then get the network working. |
|
|
acsg
Joined: 25 Apr 2021 Posts: 8 Location: Rio de Janeiro - Brazil
|
|
Posted: Tue Apr 27, 2021 5:22 pm |
|
|
Hi guys,
As i said, here are my discussions about your responses:
I considered all offers of technical support for Mr Ttelmah, temtronic and bkaman.
Before start with new code, two problems remain:
Pic MCU 18f97j60 stores .bin files in flash memory after MPFS utility,
and Chinese device speakers need to store Fat16 .wav files in your flash memory to play.
1- How to copy one to another, if files are in different formats?
2 - What other way to transfer them to each other except by using VNCL1-VDAP?
Regards. _________________ "For by wise counsel you will wage your own war."
Pv24:6 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Wed Apr 28, 2021 2:56 am |
|
|
'Files' are just data. No filesystem need be involved.
When using the Vinculum, you can open a file, write data to this, and close
the file.
So you store the data locally with a 'name'.
Then using the Vinculum tell it to open the file with this name on the target
device, and then write the data to this. When you have finished writing,
close the file.
So the PIC never has to involve a filesystem at all.
However I have to repeat, why store the data into flash?. The problem with
flash is that at the end of every page of data you have to stop operations
while you wait for it's write to complete. If data is arriving continuously from
the network, this could be a problem. Hence much easier to store to SRAM
than to flash. |
|
|
acsg
Joined: 25 Apr 2021 Posts: 8 Location: Rio de Janeiro - Brazil
|
|
Posted: Wed Apr 28, 2021 5:44 am |
|
|
Hi guys,
Yes, I am now with a better understanding to reorganize the codes.
As you said, I will divide it into stages of communication and change some parts of the circuit.
After each success, I will unite the entire process.
I will soon post a result to help others "bit twiddling" here.
Thank you very, very much guys. _________________ "For by wise counsel you will wage your own war."
Pv24:6 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|