Direct download from a PC

Questions on UARTs, and serial communication
Post Reply
YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Direct download from a PC

Post by YahooArchive »

Hi,

I am using an ARMite to control a LED matrix and need to upload characters and
sprites directly into the flash memory of the ARMite (approx 2K), is there any
way of loading the data direct from a file into s specific area of the memory
map?

John



YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: Direct download from a PC

Post by YahooArchive »

John,

It can be done, but is a bit tedious. The ARMmite receives a single character
on the USB port from the PC with the RD0 command, and writes a series of 4-byte
"numbers" (32 bits) to flash using the WRITE command. You have to chop up your
data in bytes on the PC and send them one at a time, and then reassemble them
into numeric values and store them in an array on the ARMmite.

Below is a bunch of code, starting with part of my Digital Idle Control (runs
the Idle Control Valve on my '83 BMW, and is in testing for production as an
aftermarket replacement for the OEM analog device supplied by BMW.) Then code
from a Liberty Basic program that loads the ARMmite from a .csv file on my PC
via the USB port.

The PC sends a "W" to the ARMmite to tell it that it wants to write to flash.
The ARMmite is looping reading the engine RPM and adjusting the idle speed, and
on each cycle it sends status data and checks for a command from the PC, if one
is connected.

The PC then sends 28 numeric values from the .csv file converted to characters
and padded with zeros. It also displays the values sent and then receives
characters from the ARMmite to see if the write was good.

The ARMmite receives one character at a time, assembles them in 4 byte groups,
converts them to numeric, and stores them in an array. It them sends "WRITE" to
the PC to confirm the operation.

Then the array is blasted into flash memory.

Note: Neither of these routines are complete - they won't just run by
themselves! Also, about 1 in 10 flash attempts results in corrupted values on
the ARMmite. I'm not sure why - timing on the USB transfer perhaps, or errors
on the flash write. The ARMmite always says "WRITE" like it was good.

Let me know if you need more explanation of what this code is doing.

Ira
Kalmus Automotive Engineering

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: Direct download from a PC

Post by YahooArchive »

If you mean at the time of loading your program then that should be possible,
depending on the the capabilities of the development system.

If you are using ARMbasic others here can better advise you.

If you are using a C development system check your linker documentation to see
what facilities it has for linking raw binary data with your executable.

If you are using Oberon-07 / Armaide we have implemented a scheme which allows
you to attach arbitrary named data (e.g. fonts, images, application-specific
data etc.) to program modules which are then appended to the executable at link
time. The data can be acessed as arrays from named resources within your
application without having to know the absolute addresses of where it is stored
- similar to the way you might access binary data from a file on a PC system.

For more information and examples download a copy of the document "Oberon for
LPC2000 Microcontrollers" from our website at:

http://www.cfbsoftware.com/armaide

The relevant sections are:

6.3.11 ResData Function Calls

6.4 Resource Data

Regards,
Chris Burrows
CFB Software
http://www.cfbsoftware.com

Post Reply