Hello!
I got a 8Mbit Serial Flash Memory connected to the MSP via SPI. The Flash is used to save measured Data with the Real Time. All values are saved as hexadecimal.
I coded a function to get the Data out of the Flash and send it via Uart to PC (Uart to RS232 converter on board and a RS232 to USB converter). In general there is no Problem with the communication. If all I do is sending the hexadecimal values everything works perfect.
The problem occurs if I modify the Data to have it transmitted in ASCII to be able to directly use it to save it in a .txt and work with the Data in Excel. I tried 2 different ways of conversion: Using Sprintf() or a Modulo operation to seperate each digit.
There are 65536 Data packages on the Flash. After filling the whole Flash with Data and reading it from PC with HTerm it happens that during the transfer of approximatly 40 completely random packages the MSP has some kind of hiccup. On the receiving side there is almost one whole package missing. It just continues in the next package from a little earlier. This leaves around 80 packages flawed which is not acceptable.
Since the hexadecimal transfer works it must be some issue for the MSP modifying the Data. First the code retrieves a whole package of 16 Bytes from Flash and saves each Byte in an array.
the code of the conversion with sprintf:
////////////////////////////
char daten[10]; sprintf(daten,"%d.",FLASH_ausgelesene_Daten[0]); Uart_print(daten); sprintf(daten,"%d.",FLASH_ausgelesene_Daten[1]); Uart_print(daten); sprintf(daten,"%d;",FLASH_ausgelesene_Daten[2]); Uart_print(daten); sprintf(daten,"%d:",FLASH_ausgelesene_Daten[3]); Uart_print(daten); sprintf(daten,"%d:",FLASH_ausgelesene_Daten[4]); Uart_print(daten); sprintf(daten,"%d;",FLASH_ausgelesene_Daten[5]); Uart_print(daten); sprintf(daten,"%d;",FLASH_ausgelesene_Daten[6]); Uart_print(daten); sprintf(daten,"%d;",FLASH_ausgelesene_Daten[7]); Uart_print(daten); //this part converts into char splitted integers back into integers int Spannung,Temperatur,Strom,Druck; Spannung=(FLASH_ausgelesene_Daten[8]<<8)+(FLASH_ausgelesene_Daten[9]); Strom=(FLASH_ausgelesene_Daten[10]<<8)+(FLASH_ausgelesene_Daten[11]); Temperatur=(FLASH_ausgelesene_Daten[12]<<8)+(FLASH_ausgelesene_Daten[13]); Druck=(FLASH_ausgelesene_Daten[14]<<8)+(FLASH_ausgelesene_Daten[15]); char spannung[10],strom[10],temperatur[10],druck[10]; sprintf(spannung,"%d;",Spannung); sprintf(strom,"%d;",Strom); sprintf(temperatur,"%d;",Temperatur); sprintf(druck,"%d",Druck); Uart_print(spannung); Uart_print(strom); Uart_print(temperatur); Uart_print(druck); Uart_SendByte(0x0A);
///////////////////////////
The F233 is quite small with only 8kB Flash and 1 kB RAM and I use it pretty much to its capabilities:
MSP430: Loading complete. There were 7568 (code) and 26 (data) bytes written to FLASH. The expected RAM usage is 829 (uninitialized data + stack) bytes.
Might it be the case, that the MSP has problems processing the conversion and therefor has these hiccups are does someone else have any idea?
We consider using the F235 with doubled Flash and RAM with the next boards, is it possible that the hiccups won't occur on the big brother?
I hope someone understands my Problem and can help me. I am trying a workaround by converting the Data on PC, but my lack of Skill with Visual Studio gives me issues there.