Pic32MZ2048EFH100 /200Mhz Uart's too slow

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

Moderator: Benj

Post Reply
Speed64
Posts: 39
Joined: Sat Jul 16, 2016 12:08 pm
Has thanked: 4 times
Been thanked: 2 times
Contact:

Pic32MZ2048EFH100 /200Mhz Uart's too slow

Post by Speed64 »

Hello,
I have a problem.
PIC32mz2048efh100 with 24Mhz external clock.
200Mhz system clock
Uart3 = 9600 baut
sends with 2400 baut.
download/file.php?mode=view&id=31652

where is the mistake?
Attachments
Oit Heizung V1.fcfx
(17.55 KiB) Downloaded 338 times

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: Pic32MZ2048EFH100 /200Mhz Uart's too slow

Post by stefan.erni »

Hi Speed64


You can insert a C Code with a line like this.
This C Code has to be after the init the Uart!
I did not try the 9600 baud but for the 115200 it's working nice.

U1BRG=2592; // setzt uart 1 auf 9600
U4BRG=216; // setzt uart 4 auf 115200

regards

Stefan

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: Pic32MZ2048EFH100 /200Mhz Uart's too slow

Post by medelec35 »

Hi Speed64,
before changing any register values, make sure that clock speed and configuration settings are correct.
You can do that by running a 1 second flash test.
Martin

Speed64
Posts: 39
Joined: Sat Jul 16, 2016 12:08 pm
Has thanked: 4 times
Been thanked: 2 times
Contact:

Re: Pic32MZ2048EFH100 /200Mhz Uart's too slow

Post by Speed64 »

hello medelec35

I have the test via an interrupt (clock 10ms) in the software
Interrupt call "measure"
in "Measure" count up to 50 then set A6 = 1
and count up to 100 then set A = 0 and count to 0
so on, that works ok

hello stefan.erni
it works now

is that a compiler error?
normally this works for most chips without the C code

Thanks again

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: Pic32MZ2048EFH100 /200Mhz Uart's too slow

Post by stefan.erni »

Hi Speed64, Hi Medelec

PIC32MX and PIC32MZ have different value for the Baudrateregister and there is a BRGH Bit to set or clear.

I don't really know that either. But the problem is just in the PIC32MZ and not in another PIC like PIC16.

regards

Stefan

User avatar
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: Pic32MZ2048EFH100 /200Mhz Uart's too slow

Post by Benj »

Hello,

Have you done a 1 second flash test to confirm your micro is running at the right speed?
https://www.matrixtsl.com/wiki/index.ph ... ED_flasher

Speed64
Posts: 39
Joined: Sat Jul 16, 2016 12:08 pm
Has thanked: 4 times
Been thanked: 2 times
Contact:

Re: Pic32MZ2048EFH100 /200Mhz Uart's too slow

Post by Speed64 »

hello stefan.erni , medelec35 , Benj


the C code here from stefan.erni has helped. Danke

U3BRG=2592; // setzt uart 3 auf 9600 // sets Uart3 to 9600 baut
This C Code has to be after the init the Uart!
According to the data sheet, this is a divider for the UART
a bug for me

does the value have to be changed when the clock is changed?


Hi Benj
Have you done a 1 second flash test to confirm your micro is running at the right speed?
Yes of course
I tested it as described above

Thanks again

Post Reply