Hello
I am new to embedded programming and i have been trying to transfer a binary file and save it to flash memory using uart. The problem is that i do not know when to stop reading bytes from uart. That is because in my project the files do not have standard size , nor have a special char in the end. Is there any technique for this to be done. I am using keil compiler and a beautifully "datasheeted" c8051f320. The uart ISR for reading the file is the bellow:
INTERRUPT(Uart_Isr, INTERRUPT_UART0) { if(RI0 == 1 ){ LED = !LED; //Blink LED for each input RI0 = 0; //Reset the uart read flag byte = SBUF0; //Store byte read flashBuffer[buffer_counter] = byte; //save it to a FLASH buffer buffer_counter++; if(byte == 4){ //If End Of Transmition fileTransfered = 1; REN0 = 0; //Disable RX } } }
I also used a c script to write 0x4 (End of transmition byte or EOT) in the end of the files to be downloaded(weird but worked if the file had only char data).
Thank you in advance
P.S some more complex expressions dont seem to work , like flashBuffer[buffer_counter+] = SBUF0; Meaning that i get my code compiled but the program doesnt work
Because the Flash is internal, there are no "tricks" that you can do yourself - you are totally reliant on what the manufacturer provides...
Because the Flash is internal, there are no "tricks" that you can do yourself
The F3xx have a sfr bit that makes xdata writes go to flash
The OP is actually talking of a bootloader which is possible with all SILabs chips (that I know of)
Erik
Searching again in silab's application notes page (www.silabs.com/.../ApplicationNotes.aspx) , i found one called "AN112 UART In-Application Code Loading Examples" that is an app similar to what i'm trying to do. I think this coding example should help me a lot understanding how iap on C8051Fxxx works. Thank you all for the replies.