I am currently working on a project where I am using the serial communication.
I am using an AEK-MCU-C4MLT1, with SPC5 studio on a windows PC.
In particular, I am capable to transmit data but not to receive data.
I tried also enabling the interrupt, either for the transmission and the reception, and I found out that the program enters the interrupt each time I call the function sd_lld_read, even if I send no data externally (from docklight).
By sending data from docklight, and looking at the rx_buffer I am not able to read anything.
I attach the relevant part of the code here:
int main(void) {
/* Initialization of all the imported components in the order specified in
the application wizard. The function is generated automatically.*/
componentsInit();
/* Uncomment the below routine to Enable Interrupts. */
irqIsrEnable();
sd_lld_start(&SD1,&serial_config_UART);
sd_lld_read(&SD1, (uint8_t*)aux_rx, 1000);
memset(aux_rx,0,sizeof(aux_rx));
/* Application main loop.*/
for ( ; ; )
{
sprintf(aux_tx,"ATE1\r\n");
sd_lld_write(&SD1,(uint8_t *)aux_tx, (uint16_t)(strlen(aux_tx)));
osalThreadDelayMilliseconds(5000);
}
void rxreceive(SerialDriver *sdp)
{
(void)sdp;
}
void txreceive(SerialDriver *sdp)
{
(void)sdp;
pal_togglepad(PORT_F,10);
}
Do you have any idea of what do I have to do in order to receive data and correctly read data? Do you know if I have to call another function in the interrupt?