cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling Serial receive interrupt(UART)

DNewm.1
Associate III

Hello

I'm working with spc560p and I want to enable serial receiv​e interrupt, that whenever data received, it save the data and so on.

I could send data by serial driver as sd_dll_write command and its ok. But when I want to use sd_dll_read, actually mcu stopped. It is cleared that I should use interrupt. But need some help.

Thanks​

14 REPLIES 14
ODOUV.1
ST Employee

Hello,

happy that it works now.

You must set sync to 0 before each time you call sd_lld_read:

if (sync == 1) {

sync = 0;

sd_lld_read(...);

}

Would you please put a best answer if you are happy of my support.

Best Regards,

-Olivier

Thank you for your answer.

Thanks for your answering. My problem is solved now.

Thank you ��​

Great ��

Have a nice day

DNewm.1
Associate III

Hello

In other projects, I worte below codes but interrupt don't work correctly. It just send 0xAA but it don't recognize any messages.

int sync =0;

​void myRXCB(SerialDriver *sdp){

(void​)sdp;

sync = 1;

}

for(;;){

sd_lld_write(0xAA);

if(sync ==1){

sync=0;

sd_lld_read(Buffer);

}​

}​

And when I write below codes, it recognize messages but it just send 0xAA when receive was complete.

​for(;;){

sd_lld_write(0xAA);

sd_lld_read(Buffer);

}

Would you please help me out with this method that MCU send 0xAA and recognize massages ​by uart interrupt.

Thanks ​