ds30 Loader free edition forums
Frequency for external Oscillator [solved] - Printable Version

+- ds30 Loader free edition forums (https://picbootloader.com/forum)
+-- Forum: Support (https://picbootloader.com/forum/forumdisplay.php?fid=3)
+--- Forum: 16-bit firmwares (https://picbootloader.com/forum/forumdisplay.php?fid=6)
+--- Thread: Frequency for external Oscillator [solved] (/showthread.php?tid=376)



Frequency for external Oscillator [solved] - BeastyK - 2011-08-15


I want to use the ds30 Loader with my dsPIC30F411.
What kind of changes did I have to do if my external Oscillator is about 20 MHz (its a stupid choice cause I couldn't use the PLL) and I take the alternate UART1 Pins?
Only this one on settings.inc:

Code:
;------------------------------------------------------------------------------
; Device
;------------------------------------------------------------------------------
        ;.equ __24F16KA102,         1            ;xxx uncomment and change if using PIC24F device
        ;.equ __24FJ128GA010,         1            ;xxx uncomment and change if using PIC24FJ device
        ;.equ __24HJ128GP504,         1            ;xxx uncomment and change if using PIC24HJ device
        .equ __30F4011,             1            ;xxx uncomment and change if using dsPIC30F device
        ;.equ __33FJ256GP710,         1            ;xxx uncomment and change if using dsPIC33FJ device


;------------------------------------------------------------------------------
; Includes
;------------------------------------------------------------------------------
        .include    "devices.inc"


;------------------------------------------------------------------------------
; User preferences
;------------------------------------------------------------------------------
        .equiv     FCY,                 20000000        ;xxx speed of internal cycle clock[Hz], used to calculate uart brg and delay
        .equiv    BLINIT,                3000        ;xxx hello receive timeout [ms]
        .equiv    HELLOTRIES,            2            ;xxx number of non hello characters received before branching to the user application    
        .equiv    BLTIME,                3000        ;xxx data receive timeout [ms]
        

;------------------------------------------------------------------------------
; UART settings
;------------------------------------------------------------------------------        
        ;.equiv    USE_UART1,            1            ;xxx uncomment to use uart1
        ;.equiv    USE_UART2,            1            ;xxx uncomment to use uart2
        ;.equiv    USE_UART3,            1            ;xxx uncomment to use uart3
        ;.equiv    USE_UART4,            1            ;xxx uncomment to use uart4
        .equ    USE_ALTIO,            1            ;xxx uncomment to use uart 1 alternative i/o, only for dsPIC30F
        .equiv     BAUDRATE,             115200        ;xxx baudrate
        ;.equiv    USE_ABAUD,            1            ;xxx uncomment to use auto baud rate detection, READ ERRATA FIRST        
        ;.equiv    USE_BRGH,            1            ;xxx uncomment to use high baud rates, READ ERRATA FIRST, not available for PIC24F        
        ;.equiv    USE_TXENABLE,        1            ;xxx uncomment to use a tx enable pin        
        .ifdef USE_TXENABLE
            .equiv    TRISR_TXE,        TRISA        ;xxx tris register containing tx enable
            .equiv     LATR_TXE,        LATA        ;xxx port register containing tx enable
            .equiv    TRISB_TXE,        TRISA1        ;xxx tris bit for tx enable
            .equiv    LATB_TXE,        RA1            ;xxx port bit for tx enable
        .endif
or something more???
And how must look my application (Hexfile)?

Greets
Andi



RE: Frequency for external Oscillator - Mikael Gustavsson - 2011-08-16

Because each instruction is 4 clock cycles you need to set fcy to 5000000

Mikael