Clock setting Help!!

For general Flowcode discussion that does not belong in the other sections.
seokgi
Posts: 207
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Flowcode v10 Clock setting Help!!

Post by seokgi »

Hello?
I am working on a project with PIC33EP256MC202.
I want to do serial communication at 19200 baud.
However, it does not work properly.
I set it to 19200 in FC10, but it appears normally at 2400 baud.
It seems that the oscillator setting is wrong.
I will upload the operating status.
Please help me set it up.
Thank you.
Attachments
1.jpg
1.jpg (54.57 KiB) Viewed 1651 times
2.jpg
2.jpg (90.37 KiB) Viewed 1651 times
3.jpg
3.jpg (94.48 KiB) Viewed 1651 times

seokgi
Posts: 207
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Re: Clock setting Help!!

Post by seokgi »

Here my project
Attachments
250304-V002.fcfx
(33.96 KiB) Downloaded 26 times

medelec35
Matrix Staff
Posts: 1955
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 626 times
Been thanked: 656 times

Re: Clock setting Help!!

Post by medelec35 »

Hello.
What osc speed are you after?
I have added c code to hopefully set the osc speed to 16MHz as that is what your program options show.
The internal osc Speed can be upto 64 MHz, so I would recommend being set to higher than 16MHz.

Can you let me know if not working 16MHz ,then I will look into this further.
Attachments
250304-V002.fcfx
(34.33 KiB) Downloaded 17 times
Martin

seokgi
Posts: 207
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Re: Clock setting Help!!

Post by seokgi »

Thanks for your help.
I haven't tested it yet.
I'll test it tomorrow when I get to work.
I want to run it at the maximum speed this MCU can handle, or 64MHz.
Thanks for helping me set it up.

medelec35
Matrix Staff
Posts: 1955
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 626 times
Been thanked: 656 times

Re: Clock setting Help!!

Post by medelec35 »

Hi.
You're welcome.
Hopefully, attached will run at 64MHz.
I have never used dspic devices so fingers crossed it will work.
Attachments
250304-V002 64MHz.fcfx
(33.49 KiB) Downloaded 15 times
Martin

seokgi
Posts: 207
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Re: Clock setting Help!!

Post by seokgi »

I ran the project by setting it as you helped me.
However, it doesn't run properly.

If I select 64mhz in C Code, I should select 8mhz in the settings.
Serial communication works normally, but 2400Baud and 38400baud or higher don't work. MCU works very slowly.

Do I need to change other settings? Please tell me how.
Thank you.
Attachments
1.jpg
1.jpg (172.88 KiB) Viewed 1548 times
2.jpg
2.jpg (84.76 KiB) Viewed 1548 times

stefan.erni
Valued Contributor
Posts: 1012
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 193 times
Been thanked: 217 times

Re: Clock setting Help!!

Post by stefan.erni »

Hi seokgi , Hi Martin

It is also possible to change the BRG register without the clock. The number 216 works for me for 115200.
You can calculate this for your configuration or try it out. For very slow baud rates you should also look at bit3 in the U2MODE register

Insert after Monitor init:
2025-03-05_09-17-49.PNG
2025-03-05_09-17-49.PNG (136.13 KiB) Viewed 1451 times
Program:
250304-V002_3.fcfx
(34.19 KiB) Downloaded 18 times
From the data pdf PIC:
2025-03-05_09-07-50.PNG
2025-03-05_09-07-50.PNG (94.84 KiB) Viewed 1451 times
2025-03-05_09-09-38.PNG
2025-03-05_09-09-38.PNG (195.69 KiB) Viewed 1451 times

medelec35
Matrix Staff
Posts: 1955
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 626 times
Been thanked: 656 times

Re: Clock setting Help!!

Post by medelec35 »

Thanks Stefan.
Hi seokgi
It would be good to know at what clock speed hardware is running at.
The easiest way is to run a 1 sec flash test and measure the time duration the LED is on for, or you can use a scope or a logic analyser.

Then we can see if its an issue with the clock frequency or the UART component.

If it's the clock frequency it can be revisited.
Martin

seokgi
Posts: 207
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Re: Clock setting Help!!

Post by seokgi »

I want the mcu to run at 64MHz.

But with the above settings it only runs at 8mhz.

Thanks

medelec35
Matrix Staff
Posts: 1955
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 626 times
Been thanked: 656 times

Re: Clock setting Help!!

Post by medelec35 »

Sorry, I spotted an issue.
Can you try with the attached.
Attachments
250304-V002 64MHz.fcfx
(33.49 KiB) Downloaded 22 times
Martin

Post Reply