Pic32MZ2048EFG100 UART is 4 times to slow
Moderator: Benj
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Pic32MZ2048EFG100 UART is 4 times to slow
Hi Ben
Have a problem with the Pic32MZ2048EFG100 and the UART.
The speed from the hardware UART is about 4 times to slow. The clock is ok with 200Mhz because the delay from 1mSec is perfect.
How can I acces the PB2DIV from the PIC?
regards
Stefan
Have a problem with the Pic32MZ2048EFG100 and the UART.
The speed from the hardware UART is about 4 times to slow. The clock is ok with 200Mhz because the delay from 1mSec is perfect.
How can I acces the PB2DIV from the PIC?
regards
Stefan
- 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: Pic32MZ2048EFG100 UART is 4 times to slow
Hello,
On the PIC32 devices there is a peripheral clock as well as the main oscillator clock. Can you post your program so we can see what the various configuration settings are set to.
On the PIC32 devices there is a peripheral clock as well as the main oscillator clock. Can you post your program so we can see what the various configuration settings are set to.
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
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Re: Pic32MZ2048EFG100 UART is 4 times to slow
Hi Ben
I found some infos about it.
And I tried it.
But the Baudrate (speed) did not change.But I dont have a error. Maybe I did something forget?
http://ww1.microchip.com/downloads/en/D ... 01250B.pdf
I found some infos about it.
And I tried it.
But the Baudrate (speed) did not change.But I dont have a error. Maybe I did something forget?
Code: Select all
/*
Enter C code below this comment
*/
//Unlock Combination
_SFR_WRITE(&SYSKEY, 0xAA996655);
_SFR_WRITE(&SYSKEY, 0x556699AA);
//Unlock
_SFR_BIT_SET(&PB3DIV, 11);
//_SFR_BIT_SET(&PB3DIV, 1);
_SFR_BIT_CLEAR(&PB3DIV, 1);
// now lock again PB3DIC
_SFR_BIT_CLEAR(&PB3DIV, 11);
// now lock again
_SFR_WRITE(&SYSKEY, 0x0);
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Re: Pic32MZ2048EFG100 UART is 4 times to slow
Hi Ben
In a old post I found about the divider on an another PIC32(MX).
This I FPBDIV I cannot find for the PIC32MZ2048EFG100
Also a little special…. The Baudrate on the ECG PIC was ok..
http://wwww.matrixmultimedia.com/mmforu ... ilit=PIC32
In a old post I found about the divider on an another PIC32(MX).
This I FPBDIV I cannot find for the PIC32MZ2048EFG100
Also a little special…. The Baudrate on the ECG PIC was ok..
http://wwww.matrixmultimedia.com/mmforu ... ilit=PIC32
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Re: Pic32MZ2048EFG100 UART is 4 times to slow
Hi Ben
There is a little problem to fix the speed from the Uart and SPI.
I suspect that this setting is missing for the clock in FC8 and PIC32MZ2048EFG100.
When I try to change this while the PIC is running,
the PIC need 60 steps to change it. How can I program it?
Stefan
There is a little problem to fix the speed from the Uart and SPI.
I suspect that this setting is missing for the clock in FC8 and PIC32MZ2048EFG100.
When I try to change this while the PIC is running,
the PIC need 60 steps to change it. How can I program it?
Stefan
- 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: Pic32MZ2048EFG100 UART is 4 times to slow
Hi Stefan,
You should be able to use a delay icon to do the task of waiting at least 60 CPU clocks. I would guess that say a 1ms delay would be plenty.
You should be able to use a delay icon to do the task of waiting at least 60 CPU clocks. I would guess that say a 1ms delay would be plenty.
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
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Re: Pic32MZ2048EFG100 UART is 4 times to slow
Hi Ben
I like to show first the value from the register on the display of the board.
As if its working not correct.
So I tried to test with the watchdog settings
It shows me values, but if I show DEVCFG1 and change the value from the watchdog WDTPS in the project-option-config.
it shows me always the same value…..
But the value in the C-code changed
I like to show first the value from the register on the display of the board.
As if its working not correct.
So I tried to test with the watchdog settings
It shows me values, but if I show DEVCFG1 and change the value from the watchdog WDTPS in the project-option-config.
it shows me always the same value…..
But the value in the C-code changed
Code: Select all
#pragma config WDTPS = 14 to ]#pragma config WDTPS = 6
Code: Select all
//show register on display
//_SFR_BIT_SET(&PB3DIV, 4);
FCI_DELAYBYTE_MS(1);
//FCV_REGDISPLAY = &PB3DIV; //Copy to variable
//FCV_REGDISPLAY = &DEVCFG2;
FCV_REGDISPLAY = &DEVCFG1;
FCD_08221_LCD_SSD1351__ClearDisplay();
FCD_08221_LCD_SSD1351__PrintNumber(FCV_REGDISPLAY, 50, 50, 0, 0);
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Re: Pic32MZ2048EFG100 UART is 4 times to slow
Hi Ben
To set the clock divider is working but it's not the problem.
I think it's more on the UART config. It looks like the BRGH is wrong (I or 0) I will check it tomorrow….
here the code to set PB2DIV
To set the clock divider is working but it's not the problem.
I think it's more on the UART config. It looks like the BRGH is wrong (I or 0) I will check it tomorrow….
here the code to set PB2DIV
Code: Select all
//Unlock Combination
_SFR_WRITE(&SYSKEY, 0xAA996655);
_SFR_WRITE(&SYSKEY, 0x556699AA);
//_SFR_BIT_SET(&PB2DIV, 1);
//_SFR_BIT_SET(&PB2DIV, 4);
FCV_REGDISPLAY = PB2DIV;
// now lock again
_SFR_WRITE(&SYSKEY, 0x0);
FCD_08221_LCD_SSD1351__ClearDisplay();
FCD_08221_LCD_SSD1351__PrintNumber(FCV_REGDISPLAY, 50, 50, 0, 0);
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: Pic32MZ2048EFG100 UART is 4 times to slow
Hi Stefan and Ben,
I have the same problem with the PIC32MZ EFM.
My target board is Microchip Curiosity.
I attached a little test program what I used for the check.
Best Regards,
Lagoda
I have the same problem with the PIC32MZ EFM.
My target board is Microchip Curiosity.
I attached a little test program what I used for the check.
Best Regards,
Lagoda
- Attachments
-
- PIC32MZ_TimingsChecking.fcfx
- (10.33 KiB) Downloaded 175 times
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Re: Pic32MZ2048EFG100 UART is 4 times to slow
Hi Lagoda, Hi Ben
The BRGH bit is correct. It's 1. But the value for the Baudrate-generator BRG is (maybe) wrong
I attached an excel table with the old and new value. I take a measurement with my Osciloscope and it's shows 8.69 uSec for one bit. And the terminalprogram is working with 115200 Bd.
The BRGH bit is correct. It's 1. But the value for the Baudrate-generator BRG is (maybe) wrong
I attached an excel table with the old and new value. I take a measurement with my Osciloscope and it's shows 8.69 uSec for one bit. And the terminalprogram is working with 115200 Bd.
Code: Select all
// For uart Nr 4 115200 Baud C Code
U4BRG=216;
- Attachments
-
- Baudrate.xlsx
- (8.62 KiB) Downloaded 148 times
-
- Posts: 139
- Joined: Tue Jan 05, 2010 10:07 am
- Has thanked: 20 times
- Been thanked: 25 times
- Contact:
Re: Pic32MZ2048EFG100 UART is 4 times to slow
Hi Ben et al,
Just to say that I obviously have run into this problem as well. We have not tried Software UART option (in case this works for some reason) as we need the RXINT though.
Our MCU FYI is PIC32MZ1024EFE100
The only solution at the moment is to modify the Flowcode settings to match the real life. Simply multiply by 4x the baud rate used, set the Baud Options to Custom and enter the new number into the Baud Rate field for the UART Component in Flowcode 8.
SO TO MAKE IT CLEAR FOR OTHER PEOPLE RUNNING INTO THIS PROBLEM...
Say you use baud rate 57600 (our case). Simply multiply this number by 4x which equals 230400. And enter this new number in the Flowcode properties window as below. The clocked UART output stream runs exactly at 57600bps
Hope this helps, regards!
R
Just to say that I obviously have run into this problem as well. We have not tried Software UART option (in case this works for some reason) as we need the RXINT though.
Our MCU FYI is PIC32MZ1024EFE100
The only solution at the moment is to modify the Flowcode settings to match the real life. Simply multiply by 4x the baud rate used, set the Baud Options to Custom and enter the new number into the Baud Rate field for the UART Component in Flowcode 8.
SO TO MAKE IT CLEAR FOR OTHER PEOPLE RUNNING INTO THIS PROBLEM...
Say you use baud rate 57600 (our case). Simply multiply this number by 4x which equals 230400. And enter this new number in the Flowcode properties window as below. The clocked UART output stream runs exactly at 57600bps
Hope this helps, regards!
R