Setting PB2CLK for PIC32MZ2048EFG144 - Unlock Sequence

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Setting PB2CLK for PIC32MZ2048EFG144 - Unlock Sequence

Post by Brendan »

Hello experts,

I'm needing to change PB2CLK for correct UART speed, though I've come across need to exercise an unlock sequence before being able to change the prescaler. Presently the UART has to be declared at 4x speed in Flowcode with the default SYSCLK division of 2 (PB2CLK = 100MHz), so fundamentally I'm trying to exercise the following in a C block... PB2DIVbits.PBDIV=8

I realise I'm being a little lazy here, but wondering if anyone has successfully exercised the applicable unlock sequence in a C block, or can offer a few pointers?

Thank you in advance,
Brendan

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: Setting PB2CLK for PIC32MZ2048EFG144 - Unlock Sequence

Post by stefan.erni »

Hi Brendan

There is like sample how to unlook:

http://www.matrixtsl.com/mmforums/viewt ... nce#p91247

But for the UART Speed read this:

http://www.matrixtsl.com/mmforums/viewt ... 76&t=22017

I hope it helps

regards
Stefan

Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Re: Setting PB2CLK for PIC32MZ2048EFG144 - Unlock Sequence

Post by Brendan »

Thank you Stefan, a very useful link!

I originally came across the following and couldn't believe that simply changing a clock prescaler could be so cumbersome - but evidently it is.
https://www.microchip.com/forums/m935190.aspx

Tech used to be so much less bloated - and much more productive :?

Thank you again, and best regards,
Brendan

Post Reply