STM32f030C8 UART Interrupt

Any bugs you encounter with Flowcode should be discussed here.
chipfryer27
Valued Contributor
Posts: 1313
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 317 times
Been thanked: 458 times

Re: STM32f030C8 UART Interrupt

Post by chipfryer27 »

Hi

It turns out I do have a chip, the "R8" which appears to be the big brother of the "C8". It is on a development board I bought a while back. Not sure if I have used it yet though.

If I still have it I'll try and see if I have similar issues.

Regards

Alan_37
Posts: 173
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 52 times
Been thanked: 25 times

Re: STM32f030C8 UART Interrupt

Post by Alan_37 »

Hi ,

I would like to explain what this project is going to be about .

I am developing a data Analyzer for split type air-conditioners
data communication analyzer , recorder and playback
between the indoor and outdoor unit .

I was able to make this work but I felt like trying to reinvent the wheel , it got ridiculously complicated just to receive
a string and send it back, the macro receive string and send string should have done this as it dose on other targets
like stm32f4 , Atmega328 and 2560 .
Attachments
Flowcode1.fcfx
(15.2 KiB) Downloaded 207 times

mnfisher
Valued Contributor
Posts: 1213
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 118 times
Been thanked: 622 times

Re: STM32f030C8 UART Interrupt

Post by mnfisher »

Can you try:
RXTest.fcfx
(15.67 KiB) Downloaded 236 times
Attempting to read a string on UART (1200baud) - with a newline character ('\n' or 10) as end marker - depending how you send the string you might need to change this...

Martin

Alan_37
Posts: 173
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 52 times
Been thanked: 25 times

Re: STM32f030C8 UART Interrupt

Post by Alan_37 »

Hi Martin ,

Thanks for your reply ,

split type air-conditioners Example GREE : communicate using 20 Hex bytes @1200 baud every 500ms , and the last byte
is a CheckSum8 Modulo 256 so it is expected to be always different unless nothing changes in the data .

So there is no end marker in the data ,but I will defiantly take a look at your flow see what I can steal from it :) .

Regards ,

Alan

mnfisher
Valued Contributor
Posts: 1213
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 118 times
Been thanked: 622 times

Re: STM32f030C8 UART Interrupt

Post by mnfisher »

If it's a fixed number of bytes then check 'pos' in the interrupt handler - if you've received 20 bytes then 'stop' (pos = 20 after increment (make buffer bigger and remove the % 20) - process the data and then resume.

This, of course, doesn't allow for transmission errors, timeouts etc - so will need a little extra checking to handle these (in a perfect world - life would be simpler?)

Martin

chipfryer27
Valued Contributor
Posts: 1313
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 317 times
Been thanked: 458 times

Re: STM32f030C8 UART Interrupt

Post by chipfryer27 »

Hi

Just checked my board. Last night I looked online and the info suggested my chip would be similar to yours, but it's actually a STM32F446RET6.

I'll still have a play but it will be later in the week.

Regards

mnfisher
Valued Contributor
Posts: 1213
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 118 times
Been thanked: 622 times

Re: STM32f030C8 UART Interrupt

Post by mnfisher »

I tested on a Nucleo-F401RE which is as near as I can get. 8Mhz at least?

I swapped to Channel 2 to try and use the Rx Tx pins on A2 and A3 - I couldn't read/write on Tx / Rx pins (using an FTDI chip) - but it did work connecting to the USB port on the board (in my case COM3) with putty.

I modified slightly to display the string on 20 chars received and set an LED on A5 on on interrupt - when displaying the string it turns the LED off again.

It seems to work - but if data is sent whilst printing the string then it stops working (LED no longer lights - interrupt not fired). This is a danger when mashing the keyboard :-) and at such a slow baud rate..
RXTest.fcfx
(16.34 KiB) Downloaded 208 times

Alan_37
Posts: 173
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 52 times
Been thanked: 25 times

Re: STM32f030C8 UART Interrupt

Post by Alan_37 »

Hi

I have solved this issue using a circular Buffer , it is now working 100% without any issues .

Thanks to everyone for the help

Regards

Alan
Attachments
RXTest.fcfx
(18.75 KiB) Downloaded 213 times

Post Reply