View Single Post
Old 1st Dec 2022, 10:24 pm   #62
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,553
Default Re: Tesla Programmer

Preliminary serial transfer results on the Arduino Micro are good, there is enough RAM on the Arduino Micro to create a CHAR array 'RxBuffer=[1440]' and then I read each serial byte as it comes in and as soon as I see a ':' (First character in a legitimate Intel Hex file) I just start reading each serial byte in as soon as it becomes available and stuff it into the next available slot in RxBuffer without making any attempt to parse it at that stage. I've tested this at serial speeds of up to 230400 so far (without software handshaking) and it never loses a byte.

End-Of-File is detected simply by measuring the interval since the last serial character was received - if more than 200mS has elapsed since the last received character then the host is assumed to have finished transmitting the file. If it were not for this fifth of a second delay the transfer would seem more or less instant.

The code then works through the Intel Hex file stored in RxBuffer, checksumming it and (potentially) saving the raw bytes although I'm not doing that yet.

As a RAM saving measure I intend to put the decoded raw bytes in the first 512 bytes of RxBuffer rather than in their own 512-byte array which would be pushing things a bit. This is possible because at least two bytes (ASCII characters) have to be read from the buffer to extract one raw byte of data, so it is perfectly OK to overwrite already decoded Intel Hex bytes with the raw data which will eventually fill the first 512 bytes of the RxBuffer array.

As things stand this might also work on an Uno with its 2K of RAM, I will try that when I get a chance.

I haven't (yet) done any work on the device programming side.
SiriusHardware is offline