problem RXINT stm32
Moderator: Benj
-
- Posts: 110
- Joined: Mon Dec 23, 2013 9:34 pm
- Has thanked: 2 times
- Been thanked: 9 times
- Contact:
problem RXINT stm32
Hello to all
I would like to present you the problem that I encountered using the STM32F407EV chip, which concerns the interrupt on the RX pin of the serial port 232, in previous experiments I have always used arduino mega2560 and with your advice I had always solved about the RX interrupt, now I wanted go to the STM32 platform, the circuit is composed of the disply touch which sends the commands of the keys via the serial port, the card recognizes them and sends the command to view the next page, pressing the menu key enter the 7 byte sequence from the display that identifies the key pressed (in decimal 101 00 05 00 255 255 255) as seen from photo 1 of the analyzer, but using stm32 the displayed data are all mixed (photo 2), while using arduino they are in the correct positions, even if it is always missing the last byte (photo 3).
in the program I also put a led that activates when it enters the data capture routine and in the STM32 it seems to work for a single touch and then hang, while on arduino it continues to receive.
The program is the same for the 2 platforms
why this? do I use a wrong method to detect data? do you have any examples to do better?
FC v8.2.0.12 Professional Version
thank you very much
I would like to present you the problem that I encountered using the STM32F407EV chip, which concerns the interrupt on the RX pin of the serial port 232, in previous experiments I have always used arduino mega2560 and with your advice I had always solved about the RX interrupt, now I wanted go to the STM32 platform, the circuit is composed of the disply touch which sends the commands of the keys via the serial port, the card recognizes them and sends the command to view the next page, pressing the menu key enter the 7 byte sequence from the display that identifies the key pressed (in decimal 101 00 05 00 255 255 255) as seen from photo 1 of the analyzer, but using stm32 the displayed data are all mixed (photo 2), while using arduino they are in the correct positions, even if it is always missing the last byte (photo 3).
in the program I also put a led that activates when it enters the data capture routine and in the STM32 it seems to work for a single touch and then hang, while on arduino it continues to receive.
The program is the same for the 2 platforms
why this? do I use a wrong method to detect data? do you have any examples to do better?
FC v8.2.0.12 Professional Version
thank you very much
- Attachments
-
- photo2 STM32.jpg (89.41 KiB) Viewed 4736 times
-
- photo3 arduino.jpg (70.97 KiB) Viewed 4736 times
-
- prova display ARDUINO.fcfx
- (22.9 KiB) Downloaded 172 times
-
- Posts: 110
- Joined: Mon Dec 23, 2013 9:34 pm
- Has thanked: 2 times
- Been thanked: 9 times
- Contact:
Re: problem RXINT stm32
sorry, no analyzer image was attached
- Attachments
-
- PIN TX DISPLAY.png
- (135.55 KiB) Downloaded 465 times
-
- Posts: 110
- Joined: Mon Dec 23, 2013 9:34 pm
- Has thanked: 2 times
- Been thanked: 9 times
- Contact:
Re: problem RXINT stm32
thanks LighM
here it is
here it is
- Attachments
-
- prova display.fcfx
- (23.62 KiB) Downloaded 161 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: problem RXINT stm32
Try increasing the timeout value for the ReceiveChar(1) calls in macro RX232
e.g. ReceiveChar(2)
e.g. ReceiveChar(2)
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: problem RXINT stm32
The circular buffer component is ideal for this kind of scenario.
To use the circular buffer, just enable the interrupt at the start of your program,
use the interrupt routine to read one character into the buffer, do not disable the interrupt.
Then in your main program you can retrieve the characters from the circular buffer.
To use the circular buffer, just enable the interrupt at the start of your program,
use the interrupt routine to read one character into the buffer, do not disable the interrupt.
Then in your main program you can retrieve the characters from the circular buffer.
-
- Posts: 110
- Joined: Mon Dec 23, 2013 9:34 pm
- Has thanked: 2 times
- Been thanked: 9 times
- Contact:
Re: problem RXINT stm32
hello LeghM
I had already seen these pages and also many others, but there are passages that are not clear to me, for example in the code there is a variable called .int (also in other projects there are variables with a dot) what does it mean the point? and is not declared in the variable list
how do i store incoming data? do you automatically store them ?, how do I recall them?
sorry if they are silly questions
thanks
I had already seen these pages and also many others, but there are passages that are not clear to me, for example in the code there is a variable called .int (also in other projects there are variables with a dot) what does it mean the point? and is not declared in the variable list
how do i store incoming data? do you automatically store them ?, how do I recall them?
sorry if they are silly questions
thanks
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: problem RXINT stm32
Hello,
Variables with a . before the name are local to a macro and only exist within a macro.
They could be local variables or they could be parameters or returns of the macro.
The project explorer pane can be useful to see local variables and parameters as well as other things like globals and components etc.
Variables with a . before the name are local to a macro and only exist within a macro.
They could be local variables or they could be parameters or returns of the macro.
The project explorer pane can be useful to see local variables and parameters as well as other things like globals and components etc.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 110
- Joined: Mon Dec 23, 2013 9:34 pm
- Has thanked: 2 times
- Been thanked: 9 times
- Contact:
Re: problem RXINT stm32
Thanks benj and LeighM
I have had the opportunity to try the circularbuffer and I see that it only partially works
the data is only partially collected, I have already tried several time outs up to the maximum, the cleaning block does not seem to work and does not reset the stored data
short description of the program
1) when I press the menu button I send a series of data from the arduino display that I collect via RXint (see screenshot) and store it on circular buffer
2) check that the first data stored is 101 if it is correct I call the macro show and display the data stored from address 0 to address 6 and display them from B1 to B7, data B1-B2-B3 are correct, B4 is wrong , B5-B6-B7 are missing (see photo)
3) on returning I clean the memory
4) after a delay to display load at 0 i the variables from D1 to D7 and display them, in reality as seen from the video the data alternate from 0 to the previous value.
tests done on arduino2560 then I will take it on stm32
how can i fix it?
thanks
I have had the opportunity to try the circularbuffer and I see that it only partially works
the data is only partially collected, I have already tried several time outs up to the maximum, the cleaning block does not seem to work and does not reset the stored data
short description of the program
1) when I press the menu button I send a series of data from the arduino display that I collect via RXint (see screenshot) and store it on circular buffer
2) check that the first data stored is 101 if it is correct I call the macro show and display the data stored from address 0 to address 6 and display them from B1 to B7, data B1-B2-B3 are correct, B4 is wrong , B5-B6-B7 are missing (see photo)
3) on returning I clean the memory
4) after a delay to display load at 0 i the variables from D1 to D7 and display them, in reality as seen from the video the data alternate from 0 to the previous value.
tests done on arduino2560 then I will take it on stm32
how can i fix it?
thanks
- Attachments
-
- video+fileFC8.zip
- (4.9 MiB) Downloaded 146 times
-
- photo.jpg (94.51 KiB) Viewed 4649 times
-
- Annotazione 2020-03-29 230750.png
- (33.84 KiB) Downloaded 381 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: problem RXINT stm32
I think the problem is that if you don't immediately get D1=101 then you print 0 and wait a second.
You need to synchronise with the incoming stream of characters.
You probably need to use WaitForValue() or loop with GetByte() waiting for the 101, then wait for GetNumberBytes() to equal the number of bytes you are expecting, to ensure that the rest of the stream has arrived in the buffer. Then you can read the values.
You need to synchronise with the incoming stream of characters.
You probably need to use WaitForValue() or loop with GetByte() waiting for the 101, then wait for GetNumberBytes() to equal the number of bytes you are expecting, to ensure that the rest of the stream has arrived in the buffer. Then you can read the values.
-
- Posts: 110
- Joined: Mon Dec 23, 2013 9:34 pm
- Has thanked: 2 times
- Been thanked: 9 times
- Contact:
Re: problem RXINT stm32
Hello
attached the file that I made to read the incoming bytes on the serial, on arduino it works well, (this is the only way I managed to do) as you can see in the photo I read correctly the 7 incoming bytes, but the same program does not work on STM32. in STM32 I read the B1 (value 101) replicated on all 7 bytes, also I have almost the certainty that the flushbuffer block does not work 100% as it does not clear the buffer, while indexing correctly
thanks
attached the file that I made to read the incoming bytes on the serial, on arduino it works well, (this is the only way I managed to do) as you can see in the photo I read correctly the 7 incoming bytes, but the same program does not work on STM32. in STM32 I read the B1 (value 101) replicated on all 7 bytes, also I have almost the certainty that the flushbuffer block does not work 100% as it does not clear the buffer, while indexing correctly
thanks
- Attachments
-
- prova display ARDUINO.fcfx
- (25.79 KiB) Downloaded 109 times
-
- Annotazione 2020-03-29 230750.png
- (33.77 KiB) Downloaded 326 times
-
- foto.jpg (59.93 KiB) Viewed 4594 times