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

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

Setting PB2CLK for PIC32MZ2048EFG144 - Unlock Sequence

Postby Brendan » Wed May 13, 2020 1:29 am

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
Posts: 561
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 181 times
Been thanked: 174 times
Contact:

Re: Setting PB2CLK for PIC32MZ2048EFG144 - Unlock Sequence

Postby stefan.erni » Wed May 13, 2020 4:45 pm

Hi Brendan

There is like sample how to unlook:

viewtopic.php?f=76&t=20561&p=91247&hilit=unlock+sequence#p91247

But for the UART Speed read this:

viewtopic.php?f=76&t=22017

I hope it helps

regards
Stefan
These users thanked the author stefan.erni for the post (total 2):
Brendan (Wed May 13, 2020 5:49 pm) • Benj (Fri May 15, 2020 11:06 pm)
Rating: 10%
 

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

Re: Setting PB2CLK for PIC32MZ2048EFG144 - Unlock Sequence

Postby Brendan » Wed May 13, 2020 5:46 pm

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
These users thanked the author Brendan for the post:
Benj (Fri May 15, 2020 11:06 pm)
Rating: 5%