View Single Post
Old 30th Nov 2022, 11:35 pm   #60
Slothie
Octode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 1,287
Default Re: Tesla Programmer

Quote:
Originally Posted by SiriusHardware View Post
For the question of whether it would be feasible to serially receive 512 items of data as Intel Hex at high speed on an Arduino Uno, the answer would seem to be maybe.

I've just put a 512 byte binary file through a binary to Intel Hex conversion and the resulting Intel Hex file came out at 1,387 characters. According to various sources the UNO has 2K of RAM but of course that is shared out amongst everything on the Uno that wants some RAM such as run time variables, arrays, etc.

It does seem that it might be possible to download the whole Intel Hex file into RAM at high speed and then shift it out at whatever slower speed the programming process imposes.

If it was possible to convert the Intel Hex back to raw data during the serial load process rather than afterwards, then the buffered raw data would take up considerably less internal RAM, especially if it was 'packed' as two PROM data nibbles in every byte of Arduino RAM although I think that last step would be an unnecessary complication. Not packing the data would allow for the possibility of byte-wide data to be loaded, at which point you could let the user choose to program the PROM with bits 0-3 of the data or bits 4-7 of the data.
Well I was reusing code I had laying around from other projects, so the code wasn't optimal. I was decoding the hex bytes to binary and storing it in the memory in binary because that is what I would prefer - there is no reason that hex to binary shouldn't be able to keep up with the serial port even at high speeds. I could make a more efficient hex-binary decoder than the Arduino library function if required, however the code I was using was trying to buffer the input stream through an interrupt driven routine into a largeish circular buffer so I could use software flow control (which the file upload on my terminal program ignored!) and I think I was over-thinking it and making it more complex than necessary - the arduino's built in 16 byte buffer should be more than necessary. I'm going to cut out all that complexity and just make the simplest loop possible and if necessary slow down the baud rate.

The firmware has a flag for high or low nibble which tells it which half of the stored bytes to use for read/write operations between memory and PROM.

Everything is very much in an experimental stage!
Slothie is offline