chipKIT® Development Platform

Inspired by Arduino™

Clock frequency and an OLED display

Created Tue, 28 Apr 2015 23:26:34 +0000 by jools


Tue, 28 Apr 2015 23:26:34 +0000

I'm trying to get a 64x128 OLED display working using a ChipKit Pro MX-7 MCU and implementing SPI communication, but am having some issues. The code I'm using works perfectly on a different MCU (Freescale HCS-12), so I know the code is good, but it wont work at all on the MX-7. This makes me think that maybe it's a clock speed issue. I am currently running the MX-7 with a SYSCLK fq of 80MHz, and a PBCLK fq of 10MHz. I set this using the following statements:

#pragma config FNOSC = PRIPLL
#pragma config POSCMOD = EC
#pragma config FPLLIDIV = DIV_2
#pragma config FPLLMUL = MUL_20
#pragma config FPLLODIV = DIV_1
#pragma config FPBDIV = DIV_8

I'm running at a Baud rate of 1 MHz, which I set using the SPI1BRG, and have confirmed that this is right using a logic analyzer. My question is,firstly, is the SYSCLK the clock which is used for running the commands within my program? And also, is there any way (such as an external pin) that I can hook up to and confirm the clock speed? if not, does anybody have any suggestions as to what I could look at next? If I missed anything just let me know. Thanks.


Tue, 19 Jan 2016 21:20:51 +0000

Hi jools,

I found your post while looking through old unanswered posts. Sorry you never got a response, but I'll try to help out in case you (or anybody else) are still having problems. The sysclk is the main system clock for executing commands, yes. I don't think there is an external pin you can connect it to though. I would guess that it's a problem with the SPI configuration. Did you ever figure out the problem?