UART Component - USB-UART FT232RL hardware

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Team, Is it possible for the UART component to run the USB-UART hardware(FT232RL) in flowcode V8?

Thanks

Rod
Last edited by r_teixeir on Mon Oct 25, 2021 7:40 am, edited 1 time in total.

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

UART component

Post by r_teixeir »

Hi everyone, by studying the examples in the wiki and the various components available, iam trying to simulate and download in hardware a simple example of echo, so I can move on to my project. Iam trying to code by using the component UART flowcode 8, and in hardware USB-UART and iam not getting good results.

Can somebody run tests for me please. I have the easyic and the easypic pro, it could be pic18F45k22, pic18F87j50 or 87k22.
The USB-Uart circuit schematic uses the FT232RL.

Thanks

Rod
Attachments
USB UART - Test.jpg
USB UART - Test.jpg (71.75 KiB) Viewed 6182 times
USB UART - Pic.jpg
USB UART - Pic.jpg (109.89 KiB) Viewed 6182 times
Prog_5_USB_UART_Comm_Pic18F87k22.fcfx
(10.41 KiB) Downloaded 139 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by medelec35 »

Hi Rod.
Does this work any better?
Attachments
Prog_5_USB_UART_Comm_Pic18F87k22 v2.fcfx
(11.58 KiB) Downloaded 141 times
Martin

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Medelec, thnx for replying. The result remains the same. Strange.

Rod
Attachments
version2.jpg
version2.jpg (66.52 KiB) Viewed 6167 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by medelec35 »

Seems like hardware or UART might not be running at the correct speed?
Do you have a logic analyser or an oscilloscope?
If not have you made sure the one second flasher is running at the correct rate?
Martin

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Medlec Ive just ran a test with a hello world from mikroe's echo example
It is working fine.
Thanks

Rod
Attachments
Hardware Test - Hello World Uart- Mikroe .jpg
Hardware Test - Hello World Uart- Mikroe .jpg (103.26 KiB) Viewed 6161 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by medelec35 »

Yes, that suggests that Mikroe is controlling everything at the correct speed.
Flowcode may not, e.g. could be a configuration issue so the clock speed is wrong.
Or clock speed is correct and UART might be working at the wrong baud rate.
That's why I have asked about the one sec flash test and if you had a logic analyser or an oscilloscope.
Martin

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Medelc, here is the 1sec flasher. It seems right.

Thnx

Rod
Attachments
1sec flasher.jpg
1sec flasher.jpg (53.09 KiB) Viewed 6156 times

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Medelec, what should we do for the next steps? This is only happenning for this component(USB-UART). So you know, I have the BL0032 (dsPic-16bits) I ran the USB-Serial and it worked perfectly. But as you know it is not a third party board and it is not an USB-Uart comm.
Should I reinstall the flowcode in C: Drive? I have a laptop with ssd not enough memory in C drive, so I installed in D: drive.
I had to transfer the updates (components) which are downloaded automatically in c drive Matrix file to D drive.
Right now all the flowcode versions 6, 7 e 8 are in D drive.

Thanks

Rod

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by medelec35 »

Hi, Rod.
You are showing me the simulation, did you time the on /off times on your easypic pro?
I have a 18F46K22 so it's from the same family and that is echoing perfectly:
Echo Port.png
Echo Port.png (3.05 KiB) Viewed 6135 times
For the version I posted, you will need to add a calculation macro:
Calculation Box.png
Calculation Box.png (38.34 KiB) Viewed 6135 times
Are you running at least Flowcode V8.2.2.15?

Do you have an oscilloscope or logic analyser?
Martin

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Medelec, yes I do have an osciloscope and the previous picture also has the analog discovery of 1sec led flasher and its positive / negative edges.

Ill run the tests again about the comm again tonight and let you know about it.

Thanks

Rod

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by medelec35 »

Hi Rod.
A tip I always use to determine the UART baud rate.
Send an ASCII U it must be upper case.
measure any single pulse width.
Baud = 1/singe pulse duration.
Can you let me know the result, please?
Martin

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Medelec, I ran the tests using the another board easypic with pic18F45K22. The error remains the same as you can see by the pictures.
I was able to stablish comm with flowcode and the board but the data tx is not echoing the same message on the rx.

what is the next step?

Thanks again

Rod
Attachments
Logic analyser.jpg
Logic analyser.jpg (56.62 KiB) Viewed 6118 times
version2.jpg
version2.jpg (66.52 KiB) Viewed 6118 times

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Medelec, Ive just ran a test by changing the oscillator config to the same hello world from mikroe and it worked perfectly. I was able to stablish comm from flowcode to mikroe easy pic board. I wrote my name and tx and rx were the same messages that were trade between them and the logic analyser confirmed. One observation though, is that hexadecimal code generated was from the mikroe compiler and not from the flowcode compiler.
I tried to test again by coding using flowocode and the error remains.

So what now?

Thanks for the help

Rod
Attachments
Test worked.jpg
Test worked.jpg (60.58 KiB) Viewed 6117 times

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Medelec im getting error attached

thnx

Rod
Attachments
error message.jpg
error message.jpg (27.83 KiB) Viewed 6114 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by medelec35 »

Looking at the image of the analyser the UART is way too slow.
Can you do two things.
1. Run the 1 sec flasher measure the pin on/ off duration. what is the value?
2. I can't see the single UART pulse duration from the image, what is the value?

How often does the crashing occur?
Martin

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Medelec I wrote my name as one single hit and i got this.

Thanks

Rod
Attachments
Analyser_Teste-Rodrigo.jpg
Analyser_Teste-Rodrigo.jpg (93.26 KiB) Viewed 6095 times

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

HiMedelec here is the 1sec flasher

thnx

Rod
Attachments
1sec flasher.jpg
1sec flasher.jpg (42.6 KiB) Viewed 6095 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by medelec35 »

That instantly tells me the configuration of your flowchart does not match your hardware settings.
I have looked at a circuit for Easypic Pro and it has a crystal of 16MHz.
That means you run the microcontroller at either 16 (With PLL disabled) or 64MHz (With PLL enabled).
When I looked at your flowchart it was set at 19660800Hz which is a mismatch.
Try changing the Clock speed within Project options to 16000000 then do another flash test.
If the pulse is then 1 sec then try the UART again.
If it does not work then can you post the generated .c file please?
Martin

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Medelec I appologize i didnt mention before. With these last tests I was running the programs with the easypic board 8Mhz clock and Pic18F45K22.
With this option does it match with your observation?
Attachments
EasypicBoard Uart via USB.jpg
EasypicBoard Uart via USB.jpg (130.44 KiB) Viewed 6083 times
USB_UART_Pic18F45K22.fcfx
(10.94 KiB) Downloaded 90 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by medelec35 »

You will need to make sure the Flowcode Clock setting match the value of the crystal on your board.
If crystal is running at 8MHz ,then you need to change the clock from 19660800 to 8000000.
Both configuration settings of Mikroe and Flowcode should be the same.
The image does not show the crystal for the microcontroller.
If you look within the project options you will see the clock speed still does not match!
Configuation settings witin Project options.png
Configuation settings witin Project options.png (17.4 KiB) Viewed 6081 times
Martin

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Medelec i changed a config on the oscillator, disabled the PLL and it worked. The program was compiled in flowcode and the tests run nicely.

Your were right from the beginning on your obs about oscillation config.

Thanks I appreciate

Rod
Attachments
USB UART - Test.jpg
USB UART - Test.jpg (65.99 KiB) Viewed 6060 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by medelec35 »

Hi, Rod
Glad you have got it working.
Thanks for letting us know.
Martin

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Medelec, I thank you for walking through this with me. It was great bc I even checked the differences in clock speeds by using 2 different circuits ft232rl and the USB-UART 2 click and i got them both working great on the microcontroller that I wanted to use. Pic18F87j50.

Thanks again

Rod

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: UART Component - USB-UART FT232RL hardware

Post by r_teixeir »

Hi Martin, I changed the interrupt macro to the same way you've mentioned. Thanks for the tip. On the other side, Iam uploading two pics so you can check a problem that iam facing. Iam getting data using a third party uart by changing the anlog values on hardware, but while I use the flowcode Im not able to. Ive ran so many tests and I cant get the analog sent through uart using flowcode and BL0032, only by simulation not on hardware. I tested with, human interface, serial monitor just the uart component, etc. I did indeed got results of analog changing by using the serial monitor but had to let the connection on the serial monitor "open". I read this in wiki page "The incoming data can be seen on the Flowcode console even when the simulation is not running."

Please advise if Iam doing something wrong.

Thanks

Rod
Attachments
Analog_Output_Pot_Graph.jpg
Analog_Output_Pot_Graph.jpg (115.95 KiB) Viewed 4641 times
Analog_Output_Pot_Flowcode.jpg
Analog_Output_Pot_Flowcode.jpg (114.58 KiB) Viewed 4641 times
PROG_Test_Analog_Pot_Uart.fcfx
(16.96 KiB) Downloaded 72 times

Post Reply