Re: [Flashforth-devel] flashforth on p18f4550 - No usb?
Brought to you by:
oh2aun
|
From: Pete Z. <pza...@pz...> - 2011-10-14 14:00:50
|
Hi Scott,
That is great news...Good luck with FF on the 4550. I use the PICDEM
FSUSB Demo board here for the USB testing.
I generally go to the PIC Data Sheet for the particular processor and
study the Oscillator Configuration section carefully.
One way or another, you will need 20MHz for the USB. Other internal
frequencies will be your decision.
As another example, for the 18F6527 FF3.8 with UART at 38.4K baud, I
change the following:
ff18_usb.asm
FROM:
#ifdef OSCCON
movlw 0x70 ; Use full internal OSC frequency
movwf OSCCON, A
#endif
TO:
; ppz osc
; ------------------------------------------------------------
#ifdef __18F6527
; Internal Oscillator
movf OSCCON, W, A
iorlw b'01110000' ; 8MHz
movwf OSCCON, A
nop
; Enable Oscillator PLL
movf OSCTUNE, W, A
iorlw b'01000000' ; Enable PLL for 4x8MHz
movwf OSCTUNE, A
nop
nop
#else
#ifdef OSCCON
movlw 0x70 ; Use full internal OSC frequency
movwf OSCCON, A
#endif
#endif
; ------------------------------------------------------------
p18f-main.cfg
;;;; PIC18F6527 Internal Oscillator with PLL
constant clock = d'32000000'
p18fxxxx.cfg
ifdef __18F6527
#include p18f6527.inc
;;; #include p18f6722-family.cfg
#include p18f6527.cfg
#define PICTYPE "PIC18F6527 "
#define FLASH_HI 0xbfff
#define EEPROM_HI 0xefff
#define RAM_HI 0xff60
endif
And add the following file:
;**********************************************************************
; *
; Filename: p18f6527.cfg *
; Date: 4:23 PM 10/4/2011 *
; FF Version: 3.8 *
; Copyright: Pete Zawasky *
; Author: Pete Zawasky *
; *
;**********************************************************************
; Based on p18f6722-family.cfg by Mikael Nordman *
;**********************************************************************
; FlashForth is licensed acording to the GNU General Public License*
;**********************************************************************
;;; FlashForth processor specific configuration
; The config directive is used control the processor configuration bits
; See processor specific include file for details.
#if CONFIG_RESET == 0x0000
config OSC = INTIO67
config FCMEN = OFF
config IESO = OFF
config PWRT = OFF
config BOREN = SBORDIS
config BORV = 3
config WDT = OFF
config WDTPS = 32768
config MCLRE = ON
config LPT1OSC = ON
config CCP2MX = PORTC
config STVREN = ON
config LVP = OFF
config BBSIZ = BB8K
config XINST = OFF
config DEBUG = OFF
config CP0 = OFF
config CP1 = OFF
config CP2 = OFF
config CPB = OFF
config CPD = OFF
config WRT0 = OFF
config WRT1 = OFF
config WRT2 = OFF
config WRTB = ON
config WRTC = ON
config WRTD = OFF
config EBTR0 = OFF
config EBTR1 = OFF
config EBTR2 = OFF
config EBTRB = OFF
#endif
;;; Some constants controlling how writes to program flash is made.
constant flash_write_outer_loop = d'1'
constant flash_write_inner_loop = d'64'
;**********************************************************************
As you can see, one has to really focus on the particular processor for
the OSC, PLL, and CONFIGURATION bits.
Then I really pound away on Mikael's FF code to see if it really works
like he says it should....
A software test suite (validation suite) for FF like we had in eFORTH
would really be great.
In the mean time, try all the different applications you can with lots
of different words and learn FF.
Pete
|