Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Have to enter wrong frequency in settings [solved]
#1
Issue with ds30loader PIC24HJ128GP502:

Had to change FCY by 30% to get right baud rate.

Details:

loader version 1.10. Pic24H versions of ds30loader.s, settings.inc, and .mcp files.

7.375 MHz crystal,

config __FOSCSEL, FNOSC_PRIPLL & IESO_OFF
config __FOSC, FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMD_HS & IOL1WAY_OFF

HS with PLL so FOSC= 29.50 MHz. FCY=29.5/2=14.75MHz.

.equ FCY, 14750000 ;xxx speed of internal cycle clock[Hz], used to calculate uart brg and delay
.equ BAUDRATE, 9600 ;xxx baudrate

With FCY, 14750000 GUI loader could not connect.

Added several "SendL OK" statements after init of UART, and looked with scope.
Showed ~ 68 usec per bit, baud rate of 14925.

changed to FCY 22932000 (1450000*14925/9600)

.equ FCY, 22932000

Now it connects and bootloads program successfully.

My application developed with CCS C, specifies osc at 29.48 with crystal of 7.37 and PLL.

I use input capture, output compare, and uarts at 115200 and it works fine. With my app it is running at 29.5 MHZ. This is true even after bootloading it.

Is the config setup wrong in ds30loader??

The 22.932 is 3.1 times crystal frequency, maybe within tolearnce of UART for 3 times crystal frequency. This says it is running 45.8 MHZ or 6
times the crystal frequency.

I looked at MPLab and it is using config from the code.
Reply
#2
What code did you put in the boot loader to setup PLL?
Reply
#3
Hi Donheli,

If i guess correctly, you did not change the N1, N2 & M values for the PLL configuration (CLKDIV and PLLFBD registers)
So if it's the case, you're wrong with the Fosc calculation.

With :

Fin (crystal) = 7.375MHz
N1(default) = 2
N2(default) = 4
M(default) = 50

You will get :
Fref = Fin / N1 = 3.6875MHz (OK, 0.8MHz < Fref < 8MHz)
Fvo = (Fin * M) / N1 = 184.375MHz (OK, 100MHz < Fvco < 200MHz)
Fosc = (Fin * M) / (N1 * N2) = 46.09375MHz (OK, 12.5MHz < Fosc < 80MHz)
Fcy = Fosc / 2 = 23.046875MHz

so try with :
.equ FCY, 23046875

Hope it helps
Skymixer
Reply
#4
Thanks, Skymixer. You provied the explanation.

Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)