Other Parts Discussed in Thread: LAUNCHXL2-TMS57012, , HALCOGEN
Hi,
I'm verifying communication via UART on the launchpad of LAUNCHXL2-TMS57012, which will drive RS485 transceiver. Test of sending and receiving a single character in poll mode is successful. However, the test of sending and receiving multiple characters is failed. The testing characters are "abcdefg". The phenominon seems like it can only receive some specific characters such as "fg" or "efg" or "gefg" instead of "abcdefg". Please help me find out why this happened.
The following are my test procedure.
1) I use SCI in internal loopback mode. The configurations are like below.
2) I use RTICompare0 counter0 to trigger sending 7 characters of "abcdefg" in poll mode every 200 ms. The configurations are like below.
3) I use pin clk of mibspi3 port (driving a yellow LED) to indicate sending 7 characters of "abcdefg" in poll mode every 200 ms, and bit 1 of gio portb (driving USR LED A)to indicate correct receiving characters. I use pin cs3 of mibspi3 port (input) to switch the conditions between expected character of "abcdefg" and specific characters "fg" or "efg" or "gefg" in order to observe which characters are received on earth. The configurations are like below.
4) Buffer of receiving was observed once when the program stopped by breakpoint.
4) The test code is like below.
/* USER CODE BEGIN (0) */ /* USER CODE END */ /* Include Files */ #include "sys_common.h" /* USER CODE BEGIN (1) */ #include "gio.h" #include "mibspi.h" #include "sci.h" #include "rti.h" /* USER CODE END */ /** @fn void main(void) * @brief Application main function * @note This function is empty by default. * * This function is called after startup. * The user can use this function to implement the application. */ /* USER CODE BEGIN (2) */ unsigned char txBuffer[7]={'a','b','c','d','e','f','g'}; unsigned char rxBuffer[7]; int len=7; /* USER CODE END */ int main(void) { /* USER CODE BEGIN (3) */ gioInit(); mibspiInit();//PIN_CLK for output; PIN_CS3 for input sciInit(); /* Enable interrupt */ _enable_IRQ(); while(sciIsIdleDetected(sciREG)); sciEnableLoopback(sciREG, Digital_Lbk); rtiInit(); /* Enable RTI compare 0 notification */ rtiEnableNotification(rtiNOTIFICATION_COMPARE0); /* Start counter */ rtiStartCounter(rtiCOUNTER_BLOCK0); while(1) { gioToggleBit(gioPORTB, 2); rxBuffer[0]=0; rxBuffer[1]=0; rxBuffer[2]=0; rxBuffer[3]=0; rxBuffer[4]=0; rxBuffer[5]=0; rxBuffer[6]=0; sciReceive(sciREG, len, rxBuffer); if(1==gioGetBit(mibspiPORT3, PIN_CS3)) //Changing the condition online to confirm received characters in rxBuff are wrong online. pin9@J5, 0:pin2@J3 or pin1@J5, 1:pin1@J2 { if(rxBuffer[0]=='a'&&rxBuffer[1]=='b'&&rxBuffer[2]=='c'&&rxBuffer[3]=='d'&&rxBuffer[4]=='e'&&rxBuffer[5]=='f'&&rxBuffer[6]=='g') gioToggleBit(gioPORTB, 1); } else { if((rxBuffer[0]=='f'&&rxBuffer[1]=='g') ||(rxBuffer[0]=='e'&&rxBuffer[1]=='f'&&rxBuffer[2]=='g') ||(rxBuffer[0]=='g'&&rxBuffer[1]=='e'&&rxBuffer[2]=='f'&&rxBuffer[3]=='g')) //Characters were observed by setting break points at line of while(1) after next else gioToggleBit(gioPORTB, 1); else while(1); } } /* USER CODE END */ return 0; } /* USER CODE BEGIN (4) */ void rtiNotification(uint32 notification) { sciSend(sciREG, len, txBuffer); gioToggleBit(mibspiPORT3, PIN_CLK);//pin7@J2, 0:pin2@J3 } /* USER CODE END */
best regards
Datïan