STM32f030C8 UART Interrupt

Any bugs you encounter with Flowcode should be discussed here.
Alan_37
Posts: 127
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 38 times
Been thanked: 17 times

STM32f030C8 UART Interrupt

Post by Alan_37 »

Hi

Just trying to make a simple Flow with stm32f030c8
>init urat -> receive string -> send back the string that was recived

I send Testing I receive : ggggggggggggg

Also is there a way to set uart parity to even ?

Using Flowcode V9
fc.jpg
fc.jpg (23.38 KiB) Viewed 2108 times
Attachments
Flowcode1.fcfx
(15.76 KiB) Downloaded 69 times
Last edited by Alan_37 on Tue Oct 24, 2023 2:04 pm, edited 1 time in total.

Alan_37
Posts: 127
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 38 times
Been thanked: 17 times

Re: STM32f030C8

Post by Alan_37 »

Hi again after experimenting a bit more

found that the bug is in the Uart interrupt, removing it and making the receiving string in a loop
works fine , but I wish to use the interrupt as the MCU will be doing something alse ,
also the interrupt will not work at all if the uart is in software mode .

Any help please
Attachments
Flowcode1.fcfx
(11.72 KiB) Downloaded 69 times

mnfisher
Valued Contributor
Posts: 962
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 511 times

Re: STM32f030C8

Post by mnfisher »

I think that the interrupt routine needs to just receive one character (ReceiveChar) - it can stuff this into an array or add it to a circular buffer. Currently it attempts to read the whole string.

I would suggest having the interrupt routine set a 'data_rcvd' flag on an end marker (EOL - \0 for \n for example) - then the main loop can process the string when it has been completely received.

It is difficult to receive a string in a main loop - if you are doing anything other - unless using an MCU that buffers the input (raspberry pi?) (the timing is impossible to get right!)

Martin

Alan_37
Posts: 127
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 38 times
Been thanked: 17 times

Re: STM32f030C8

Post by Alan_37 »

Hi mnfisher ,

thanks for your reply , but no I have used the interrupt this way before to receive a string
with other chips and worked fine , there is a BUG in the interrupt 100% .

If this can't be fixed right away, maybe a good workaround would be a custom interrupt
on the falling edge of the Uart RX pin, but I don't know how to do that will also be needing
another one for Urat 2 as I will be using both Uarts

Alan_37
Posts: 127
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 38 times
Been thanked: 17 times

Re: STM32f030C8

Post by Alan_37 »

anyone can help please ?

chipfryer27
Valued Contributor
Posts: 1149
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 286 times
Been thanked: 412 times

Re: STM32f030C8

Post by chipfryer27 »

Hi

Not too familiar with that chip but anytime I use the UART to Rx I use the RxInterrupt to add the character into a CB or such like, much as Martin describes above.

If you do a search for Custom Interrupt here, and in the "old forum" too, you may find details on how to set that up for your needs.

Regards

Alan_37
Posts: 127
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 38 times
Been thanked: 17 times

Re: STM32f030C8 UART Interrupt

Post by Alan_37 »

I have tried receiving 1 char at a time and then concatenate in a string but the interrupt is not working as it should .

I have been using Flowcode since V2 or 3 it had an orange Icon if memory serves me well :D ,

I've had a lot of fun budling projects like X-CORE here with Arduino and later with ARM ,
in my experience there where ALWAYS bugs in it for us to discover,
but at least support used to fix them when we reported them.

I will try to use another chip target for this one and hope for the best.

Regards

chipfryer27
Valued Contributor
Posts: 1149
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 286 times
Been thanked: 412 times

Re: STM32f030C8 UART Interrupt

Post by chipfryer27 »

Hi

Yep,some bugs are inevitable but usually Matrix are quick to resolve once identified.

Is the issue in hardware or when simulating? I ask as the last flowchart shows the API getting used.

Unfortunately I'm not familiar with the chip, nor do I have one to try to replicate the issue.

Regards

Alan_37
Posts: 127
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 38 times
Been thanked: 17 times

Re: STM32f030C8 UART Interrupt

Post by Alan_37 »

Hi

No the problem is not in simulation , is when downloading to chip ( hardware ) .

mnfisher
Valued Contributor
Posts: 962
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 511 times

Re: STM32f030C8 UART Interrupt

Post by mnfisher »

I'm interested - but I don't have the particular chip to test on either...

It looks like it is just receiving the last character ('g') of 'Testing' - which means an interrupt is occurring. You don't add an end marker to the string (a '\0' - I'm not sure if ReadString does this) and although it is initialised to "" this just sets the first character to 0. It might be worth testing by setting the whole string RX_U1 ro 0s (for .i = 0 to 127 RX_U1[.i] = '\0') I suspect the ReadString is just reading the last character for some reason?

Please post your SingleChar version too...

Martin

Post Reply