Other Parts Discussed in Thread: HALCOGEN
I have written the code to receive data the from serial port for same purpose Halcogen settings are follows
Code written reception is as follows :
void sci3HighLevelInterrupt(void)
{
uint32 vec = sciREG3->INTVECT0;
uint8 byte;
/* USER CODE BEGIN (37) */
/* USER CODE END */
switch (vec)
{
case 1U:
sciNotification(sciREG3, (uint32)SCI_WAKE_INT);
break;
case 3U:
sciNotification(sciREG3, (uint32)SCI_PE_INT);
break;
case 6U:
sciNotification(sciREG3, (uint32)SCI_FE_INT);
break;
case 7U:
sciNotification(sciREG3, (uint32)SCI_BREAK_INT);
break;
case 9U:
sciNotification(sciREG3, (uint32)SCI_OE_INT);
break;
case 11U:
/* receive */
byte = (uint8)(sciREG3->RD & 0x000000FFU);
xResult = xEventGroupSetBitsFromISR(Tsk_EventHandler,RS232ISREVT,&xHigherPriorityTaskWoken );
/*Here I am setting event bit */
/* if (g_sciTransfer_t[2U].rx_length > 0U)
{
*g_sciTransfer_t[2U].rx_data = byte;
g_sciTransfer_t[2U].rx_data++;
g_sciTransfer_t[2U].rx_length--;
if (g_sciTransfer_t[2U].rx_length == 0U)
{
sciNotification(sciREG3, (uint32)SCI_RX_INT);
}
} */
break;
case 12U:
/* transmit */
/*SAFETYMCUSW 30 S MR:12.2,12.3 <APPROVED> "Used for data count in Transmit/Receive polling and Interrupt mode" */
--g_sciTransfer_t[2U].tx_length;
if (g_sciTransfer_t[2U].tx_length > 0U)
{
uint8 txdata = *g_sciTransfer_t[2U].tx_data;
sciREG3->TD = (uint32)txdata;
g_sciTransfer_t[2U].tx_data++;
}
else
{
sciREG3->CLEARINT = (uint32)SCI_TX_INT;
sciNotification(sciREG3, (uint32)SCI_TX_INT);
}
break;
default:
/* phantom interrupt, clear flags and return */
sciREG3->FLR = sciREG3->SETINTLVL & 0x07000303U;
break;
}
/* USER CODE BEGIN (38) */
/* USER CODE END */
}
Code for reception function is as per image shown below :
Observaton of code:
1)Not Receiving all bytes which are given on serial port:
example : string given -> InputstringonSCI3port
observed input : missing random few byte after reading
2)Waiting in while loop after reception of data :
3) To avoid waiting in while loop I have used the API uint32 sciIsRxReady(sciBASE_t *sci) to check interrupt
->> not getting interrupt SCI_RX_INT always low.