cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S003F3P6 UART1 and EXTERNAL INTERRUPT ISSUE..

Chayan Roy
Associate III
Posted on January 02, 2018 at 10:04

The original post was too long to process during our migration. Please click on the attachment to read the original post.
4 REPLIES 4
raimond
Associate III
Posted on January 02, 2018 at 11:03

PD1 is SWIM. Are you sure  about using the SWIM pin in your application?

Anyway, for using it as GPIO you should disable the SWIM functionality first.

Chayan Roy
Associate III
Posted on January 02, 2018 at 11:58

Hello

Dragomir.Raimond

,

Thanks for your reply. Now, we have been using this swim pin,as General I/O,without disabling the swim function for last 1year, in our many application, we haven't faced any problem yet. Another thing is that I cannot disable the sim functionality,as we often need to reprogram the MCU after final testing. But as you have suggested, I will try disabling the swim pin. But in the code swim has nothing to do with the IR decoding and UART1.RX reception. I am trying to solve this issue, still working on,but haven't got any success.

Posted on January 02, 2018 at 13:08

Hi,

unfortunately your code is hard to follow. I don't know how you pasted it in here...

Anyway, there are weird things like:

PD_ODR ^=(1<<6);

in you PortD EXTI interrupt. (PD6 is UART RX).

Also, in the uart init code you have some weird things also, like:

UART1_CR2=(1<<5);

UART1_CR2=(1<<2);

The thing is, in such a mess you can easily slip a mistake even yourself. I can understand why you are doing what you are doing, but don't expect anyone else to follow your code in such a state.

Posted on January 02, 2018 at 17:41

Sorry for this messy  code, next time I'll try to properly paste the code.

I have checked all those things you have  mentioned. And also disabled the swim interface. I have  red the datasheet, according to that code should work, but When ever  I attach  IR sensor, UART doesn't work.

I have checked at the hardware level..but everything is ok there. I don't know why it is not working. Thanks.