Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Microcontroller looking at file in memmory

Status
Not open for further replies.

Vatican

Newbie level 4
Joined
Feb 22, 2012
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,330
Transfer a file to Micro's internal memory via usb

I believe I have a more concise way of asking the questions I originally posted in this thread:

Hi All,

I need to store a file on the internal memory of a micro, via usb, that contains integer variables, and is a 2D array of around 32 x 7 bytes. I need to be able to save this file from the host PC to the target micro, (without writing over program code obviously).

So my questions are:
1) I understand I need my host program (written in VB) to convert my output file (which is simply a str array of hex values representing the variables I need the micro's code to read, equally these could be integer values) into a hex file to be transferred via USB to the micro (which has a USB interface). Is the type of hex file dependent on the target micro, or the protocol to transfer this? (I have previously only used IAR embedded wb and a usb jtag programmer to program a micro, which is why I need a little help with this raw format and how to transfer it)
2) This is not strictly an embedded quetion, but perhaps you can aid me, what library(s) should I look into, for a VB program to transfer this created hex file to a static address on the micro? Perhaps it's a little ambitious to ask this on here?

I do hope you can help. Many thanks if you can answer any of the above, and perhaps point me towards a large book for further reading!
 
Last edited:

apologies for the double post.

(bump after complete re word of the original topic)
 

It would be quite straight forward to transfer the array without any conversion at all.

For example, if you set up one of the Endpoint in the USB Micro to be 32 bytes, then you can trasfer the 7 x 32 byte array in 7 transfers.
The on chip code of the USB micro (when receiving each 32 byte transfer) would copy the values sent from the host PC to the required locations in its on chip RAM, EPROM or FLASH.
There is nothing that is "micro" dependent in doing this, the host sends the exact values, the USB micro reads those exact values and places them wherever you like.
Check out Jan Axelson's web pages (search for Lakeview Research). She has many VB examples.
 

Thanks for your reply, its seems my rewording has enabled someone to respond! So what you're saying is...

1) I do not need specifically to transfer a file. I can address the memory space I have set aside for the variables, and transfer each byte directly?
2) I can do this from within VB

After having a poke around the recommended website, I wonder if you could point me slightly closer to home.

What exactly do you mean when you say endpoint, my googling of the term hasn't helped me?
Is what I'm trying to do essentialy ISP, requiring the use of a bootloader, or can I take a regular say atmel avr with usb capability and directly address the memory space to write the hex array to? I've looked for an app note on 'addressing internal memory' for avr based micros. but not come up with anything useful. I'll continue looking this evening at home, I think I just need another pointer in the right direction? Apologies if I've overlooked the obvious example on Jan's website.

EDIT: I see some examples, now to download and read them. I would still appreciate a little clarification on the method I should use (im looking for terminology that may help me look for more information on the subject?).

Regards
 

Vatican said:
I need to store a file on the internal memory of a micro, via usb, that contains integer variables, and is a 2D array of around 32 x 7 bytes.

If data is stored in RAM or EEPROM, you could update memory in your main code.
If it's about FLASH memory, you need to use bootloader.
 

If data is stored in RAM or EEPROM, you could update memory in your main code.
If it's about FLASH memory, you need to use bootloader.

That makes sense. Cheers for the advice.
I think we will use a bootloader to do this. I've downloaded some app notes on an avr bootloader, but is there any other 'recommended' reading?
 
Last edited:

Vatican said:
I've downloaded some app notes on an avr bootloader, but is there any other 'recommended' reading?
As far as I understand, you need to write sections in FLASH without erasing the already existing code in there. Search for a way to achieve this.

Alexandros
 

This sounds like a fairly straight forward task to do, one option is to find a tty program that can transfer files for you, such as hyper terminal, this will allow you to send you file as bytes at a set speed down a serial port to your uC, that then allows you to write code in the uC to receive the bytes and place them into an array in memory in whatever locations you want. Just buffer the incoming byte stream into the array that you want to store the data in, if you dont need to retain the data when power is switched off then simply store the data in RAM, otherwise, just buffer the data into RAM and then store it in either an EEPROM or as flash, although depending on what micro you are intending to use, writing to flash can be a pain in the arse! Speaking of which, what micro are you intending to use?
I think that by splitting the task into two chunks, the VB application and the micro program it will make the task more manageable!
Hope this helps.
/Pete
ble.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top