USART Module with 18F26k22 and PLL Enabled
Posted: Mon Dec 19, 2016 5:42 am
For a project I'm working on, the 4x increase in speed with the PLL enabled will be beneficial. I had it enabled with a 20MHz crystal, overclocking the PIC to 80MHz and everything seemed to work fine.
Everything until the USART. Even dropping back to a 12MHz crystal (I don't have any 16MHz on hand), I can't find any combination of settings to make the USART routines work properly. Without the PLL enabled, it works great. I'm communicating with a CH340G USB chip.
So, a few questions:
1. When using the PLL, should the crystal frequency be multiplied by 4 for the CLOCK statement, or is it necessary to manually account for the speed differences in delay statements and etc.?
2. What tweeks do I need to make to get the UART to work with the PLL enabled? With br=9600, and the clock frequency set to the actual crystal value, I'd expect the actual baud rate to be 38,400 but this results in giberish being received by the CH340G.
Thanks for any help,
Jon
Everything until the USART. Even dropping back to a 12MHz crystal (I don't have any 16MHz on hand), I can't find any combination of settings to make the USART routines work properly. Without the PLL enabled, it works great. I'm communicating with a CH340G USB chip.
So, a few questions:
1. When using the PLL, should the crystal frequency be multiplied by 4 for the CLOCK statement, or is it necessary to manually account for the speed differences in delay statements and etc.?
2. What tweeks do I need to make to get the UART to work with the PLL enabled? With br=9600, and the clock frequency set to the actual crystal value, I'd expect the actual baud rate to be 38,400 but this results in giberish being received by the CH340G.
Thanks for any help,
Jon