Other Parts Discussed in Thread: TMDX570LC43HDK, HALCOGEN
Hello team,
I want to transmit and receive message over SCI using Hercules Eval board (TMDX570LC43HDK). I’m able to transmit the required string through the code. However, I’m facing some issues with the received information. Picture below shows the flowchart of what exactly I want to achieve with the code. Also attached is the Terminal snapshot.
Below is my code snippet. Can you please help me with what I’ve been doing wrong?
/* USER CODE BEGIN (0) */ #include "HL_sci.h" /* USER CODE END */ /* Include Files */ #include "HL_sys_common.h" /* USER CODE BEGIN (1) */ static unsigned char command; /* 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) */ /* USER CODE END */ char text_send[]="Are you there??\n\r"; char resp1_send[]="Yeah!!!\n\r"; char resp2_send[]="Nope!!!\n\r"; //char text_recv[4]="\0"; char *text_recv; char y[] = "yeah"; char n[] = "nope"; void main(void) { /* USER CODE BEGIN (3) */ _enable_IRQ(); sciInit(); while(1) { sciSend(sciREG1, strlen(text_send), text_send); sciReceive(sciREG1, 4, *text_recv); command = strcmp(*text_recv, y); if (command == 1) //printf("Input is %s", y); sciSend(sciREG1, strlen(resp1_send), resp1_send); else //printf("Input is Nope"); sciSend(sciREG1, strlen(resp2_send), resp2_send); } /* USER CODE END */ } /* USER CODE BEGIN (4) */ void sciNotification(sciBASE_t *sci, uint32 flags) { sciSend(sci, 1, (unsigned char *)&command); sciReceive(sci, 1, (unsigned char *)&command); } void esmGroup1Notification(int bit) { return; } void esmGroup2Notification(int bit) { return; } /* USER CODE END */
Another query on the same line I’m facing is sending the counter value. I’ve written a code that transmits the counter value. The counter is initialized with value = 0 and then incremented upto 10000. Once the counter reaches 10000, it is reset to 0. This entire process is repeated infinitely. However, the issue is, no transmission is visible on the Terminal Program (Putty). Code snippet for the same is shown below. Can you please also help me with this?
/* USER CODE BEGIN (0) */ #include "HL_sci.h" /* USER CODE END */ /* Include Files */ #include "HL_sys_common.h" /* USER CODE BEGIN (1) */ /* USER CODE END */ /* USER CODE BEGIN (2) */ /* USER CODE END */ void main(void) { /* USER CODE BEGIN (3) */ sciInit(); unsigned long int counter1 = 0; while(1) { while (counter1 <10000) { while(sciIsTxReady(sciREG1) != 0) { sciSendByte(sciREG1, char(counter1)); } } counter1 = 0; } /* USER CODE END */ } /* USER CODE BEGIN (4) */ /* USER CODE END */
Thanks!
H C Trivedi