I am using a Pic18F45K40 to control an ST7590 power line networking chip which requires an 8MHz clock signal to function. I read the datasheet and it looks like a 16MHz signal can be generated from the 64MHz microchip.
I set up the Reference Clock Output Module as follows:
#pragma config CLKOUTEN = ON
#define oCLK_INIT() CLKRCLKbits.CLK=1; \ CLKRCONbits.EN=0; \ CLKRCONbits.DC=2; \ CLKRCONbits.DIV=3; \ SCANTRIGbits.TSEL=1; //OSCCON1bits.NOSC=6; #define oCLK_EN_ON() CLKRCONbits.EN=1;
and used PPS to pin RB4 by setting
RB4PPS=0b10100; /* B4=CLKR 8MHz */ \
I do get an 8MHz signal out but it looks like this:
This is more sinusoidal than square and might be the reason why I am not able to talk to the ST7590 chip via UART. Can anyone explain what is happening?
EDIT: Result of changing slew rate.