Page 1 of 1

Self programming flash

Posted: Wed Jan 05, 2011 4:02 pm
by eslavko
Hello...

I have some kind of bootloader for AtTiny85 in mind and asking if someone have some experience with that.
My idea is:
Upload pages to upper part of memory,
after all pages are uploaded then I can disconect USB driver and jump to upper half of memory (where downloaded program is and has small copy routine at statr) and copy upper part of memory to the low part of memory.
The Problem I see is in uploading pages as Tiny is HALTED for aprox 5ms when page is writed. So within this 5ms the all jobs are in stall. How this will afect the VUSB? In doc's is that only few cycles the interrupt can be dissabled and this is a way longer.

of course in this way only 1/2 memory is available but 4k is still a lot.

Slavko.

Re: Self programming flash

Posted: Sun Jan 09, 2011 3:13 pm
by eslavko
Just to answer to myself.

The 5ms stall of processor is hughe if is done in wrong time. And to be even worse the there are two stall's in series. If that's stall is in usbFunctionSetup or usbFunctionWrite the connection is sometime lost(the windows report failure of device) But if bus is in idle (ie no transaction) then I can stall the cpu for near 50ms before window's report strange thing.

So just need to check if no transaction is done in main loop.
I just setup timer to overrun in 5ms
the timer is cleared if interrupt ocour
if timer overrun then here are no packet's for me so I do tha't stall job in this time. Tested and works. I got no error report.