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
STM32f030C8 UART Interrupt
-
- Posts: 137
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 7:23 pm
- Has thanked: 41 times
- Been thanked: 19 times
STM32f030C8 UART Interrupt
- Attachments
-
- Flowcode1.fcfx
- (15.76 KiB) Downloaded 71 times
Last edited by Alan_37 on Tue Oct 24, 2023 2:04 pm, edited 1 time in total.
Re: STM32f030C8
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
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 71 times
-
- Valued Contributor
- Posts: 981
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 105 times
- Been thanked: 516 times
Re: STM32f030C8
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
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
Re: STM32f030C8
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
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
-
- Valued Contributor
- Posts: 1177
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 287 times
- Been thanked: 417 times
Re: STM32f030C8
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
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
Re: STM32f030C8 UART Interrupt
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 ,
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
I have been using Flowcode since V2 or 3 it had an orange Icon if memory serves me well ,
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
-
- Valued Contributor
- Posts: 1177
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 287 times
- Been thanked: 417 times
Re: STM32f030C8 UART Interrupt
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
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
-
- Valued Contributor
- Posts: 981
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 105 times
- Been thanked: 516 times
Re: STM32f030C8 UART Interrupt
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
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