Tool/software: Code Composer Studio
I have implemented automatic baudrate detection on my MSP430. It is working as expected however when I go from reading in the synch frame to transmitting data, the last byte of data that I send never transmits and the byte before that is also sent as a 0xFF.
Something I noticed was that when I enter debug mode everything sends perfectly, however when I just flash my program onto the MSP430 and use an oscilloscope it doesn't send the right data.
Here is my oscilloscope reading:
Here is the code that I write:
LIN_Read_Header(); LIN_Wait(); LIN_Send_Data(0x4A); //Whatever data you want to sent LIN_Send_Data(0x55); LIN_Send_Data(0x93); LIN_Send_Data(0xE5); LIN_Send_Data(0xE5); LIN_Send_Data(0xE5); LIN_CRC();
void LIN_Send_Data(volatile unsigned char data){ CRC_SUM=(CRC_SUM+data); // Keep a running sum of all the DATA CRC_SUM=(CRC_SUM&255)+(CRC_SUM>>8); while(!(UCA0IFG & UCTXIFG)); UCA0TXBUF=data; }
void LIN_CRC(){ CRC_SUM=(~CRC_SUM) & 255; while(!(UCA0IFG & UCTXIFG)); UCA0TXBUF=CRC_SUM; CRC_SUM=0; }