Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


FreeRTOS and PIC32 need PBCLK to be 12mhz.

Posted by Robert H. Oujesky on April 4, 2011
Using FreeRTOS on a custom PIC32 based board. Literally, just been running for a day! :) I am a newb to both PIC32 and FreeRTOS, so please be gentle. I need the UART to communicate with a device that is running a baud rate of 58,252. Yes, weird! Anyway, to get this baud rate, I need a PBCLK of 12mhz. I cannot seem to find where in FreeRTOS it sets PBCLK. Probably me :( Anyway, I set configPERIPHERAL_CLOCK_HZ to 12000000UL thinking this would do it. I dont think it is right, because I have a LED flashing task which flashes the led every second. when I change configPERIPHERAL_CLOCK_HZ from 40mhz to 12mhz, my led blinks a lot faster (too fast). I am not sure where to look for the correct way to do this. I bought the ebook "Using the FreeRTOS Real Time Kernel - A Practical Guide", but it does not address this at all.


RE: FreeRTOS and PIC32 need PBCLK to be 12mhz.

Posted by Richard on April 5, 2011
You need to look at the C32 libraries (that come with the compiler, not with FreeRTOS.

In main.c you will see a function called prvSetupHardware() that makes a call to the (Microchip) library functions SYSTEMConfigPerformance( configCPU_CLOCK_HZ - 1 ) and mOSCSetPBDIV( OSC_PB_DIV_2 ); You then need to set the configPERIPHERAL_CLOCK_HZ setting in FreeRTOSConfig.h to match whatever you set the clock to using these library functions.


RE: FreeRTOS and PIC32 need PBCLK to be 12mhz.

Posted by Robert H. Oujesky on April 6, 2011
Thanks! That helped a lot. Continuing on! :)

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner