Attempting to get FF 5.0 work on my XLP, 16bit demo board. I have the shipped demo working fine, and sending data out the serial port at 56k. Checking the schematic I believe UART2 is connect to the USB2TLL converter. I took the fuse config from the working program and tried it. An external 8 Mhz crystall is available on board for the PIC24F.
Not seeing data out the serial port at this time, please advise. Thank you!
; Define the UART used for the operator
**.equ OPERATOR_UART, 2 ** ; 1 or 2
;;; UART1 configuration
.equ BAUDRATE1, 38400 ; Serial baudrate UART1
.equ FC1_TYPE, 1 ; 1 = XON/XOFF, 2=CTS/RTS
.equ AUTOBAUD1, 0 ; 0 = to use fixed baudrate
; 1 = Autobaud, First char after reset must be 'U' (0x55)
;;; UART2 configuration
.equ BAUDRATE2, 38400 ; Serial baudrate UART2, comment if not used
.equ FC2_TYPE, 1 ; ; 1 = XON/XOFF, 2=CTS/RTS
.equ AUTOBAUD2, 0 ; 0 = to use fixed baudrate
; 1 = Autobaud, First char after reset must be 'U' (0x55)
Last edit: Randall Young 2018-08-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is a an external crystal @ 8 Mhz. I was suprised that the demo code did not use it explicitly.
I guess thats because the XLP demo application was focused on keeping the processor in the sleep state for power concerns and then spitting out data to the serial port at a very odd baud rate of 1,000,000 bps.
I only assume an internal frequency 8 mhz, in this condition, I haven't tested this. Where should I look? PIC24F clock setup is new to me, but easy to study however ... I guess what I should have simply asked is how to config the PIC24 to use the external crystall at 8 Mhz, to be correct for the 38,400 baud rate suggeted. I note that you do some math to the frequency to get it where you want in your code.
I would like the accuracy of the hw crystall for my application....
Last edit: Randall Young 2018-08-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
With the following modifications it should run at 8MHz with your chip (not tested).
.equFLASH_SIZE,0x2100; Flash size in bytes without the high byte; See program memory size in the device datasheet..equRAM_SIZE,0x0600; Ram size in bytes;; Check the configuration for your particular chip from the datasheet.; For some reason the normal config macros did not work.pushsection__FOSCSEL.sec,code.global__FOSCSEL__FOSCSEL:.pwordFNOSC_PRI.popsection.pushsection__FOSC.sec,code.global__FOSC__FOSC:.pwordPOSCMOD_HS.popsection.equFREQ_OSC,(8000000);Clock (Crystal)frequency (Hz); Define the UART used for the operator.equOPERATOR_UART,2; 1 or 2
Using the PLL with external crystal has not been implemented in FlashForth.
Read chapter 9, Oscillator Configuration, in the data sheet.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I made the code change requested. I see that you've modified the mem spec for the chip I have (PIC24F16KA102), then setup the clock to run at 8mhz. simple as possible. The comport is assigned as #2, which seems correct. However no charatcters seen out serial port. Any other suggestions relevant?
Thanks again for you time.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found this inside the Forth Tutorial ... Building for the PIC24FV16KM202, Section 3.3
.ifdef __24FV16KM202
.print "Customize p24f16ka_config.inc for PIC24FV16KM202"
;;; Below is the setting for max amount of ram for PIC24FV16KM202
.equ FLASH_SIZE, 0x2C00 ; Flash size in bytes without the high byte
; See program memory size in the device datasheet.
.equ RAM_SIZE, 0x0800 ; Ram size in bytes
.equ EEPROM_SIZE, 0x0200 ; Eeprom size
;;; Device memory sizes. Set according to your device.
;;; You can increase the addressable flash range be decreasing the addressable ram.
;;; Below is the setting for max amount of ram for PIC24FV32KA302
.equ FLASH_SIZE, 0x5800 ; Flash size in bytes without the high byte
; See program memory size in the device datasheet.
.equ RAM_SIZE, 0x0800 ; Ram size in bytes
.equ EEPROM_SIZE, 0x0200 ; Eeprom size
; For some reason the normal config macros did not work
.pushsection FOSCSEL.sec, code
.global FOSCSEL
FOSCSEL: .pword FNOSC_FRCPLL
.popsection
; Start additions for FF Tutorial board with PIC24FV32KA30x
.pushsection FOSC.sec, code
.global FOSC
FOSC: .pword OSCIOFNC_OFF
.popsection
.pushsection FICD.sec, code
.global FICD
FICD: .pword ICS_PGx2
.popsection
; End additions
.equ FREQ_OSC, (80000004) ;Clock (Crystal)frequency (Hz)*
the PIC24FV32KA302 is a good option, just in general, cheap and powerful.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Howdy!,
Attempting to get FF 5.0 work on my XLP, 16bit demo board. I have the shipped demo working fine, and sending data out the serial port at 56k. Checking the schematic I believe UART2 is connect to the USB2TLL converter. I took the fuse config from the working program and tried it. An external 8 Mhz crystall is available on board for the PIC24F.
Not seeing data out the serial port at this time, please advise. Thank you!
Here's my setup in p24f_config.inc
config _FBS(BSS_OFF & BWRP_OFF)
config _FGS(GCP_OFF & GWRP_OFF)
config _FOSCSEL(FNOSC_FRCDIV & IESO_OFF)
config _FOSC(FCKSM_CSECMD & POSCFREQ_MS & OSCIOFNC_ON & POSCMOD_NONE & SOSCSEL_SOSCLP)
config _FWDT(FWDTEN_OFF & WINDIS_OFF & FWPSA_PR128 & WDTPS_PS32768)
config _FPOR(MCLRE_ON & BORV_LPBOR & BOREN_BOR3 & I2C1SEL_PRI & PWRTEN_OFF)
config _FICD(BKBUG_OFF & ICS_PGx3)
config _FDS(DSWDTEN_OFF & DSBOREN_ON & RTCOSC_SOSC & DSWDTOSC_SOSC & DSWDTPS_DSWDTPSF) //DSWDT SOSC = LPRC
.equ FREQ_OSC, (8000000*4) ;Clock (Crystal)frequency (Hz)
.equ FCY, (FREQ_OSC/2)
; Define the UART used for the operator
**.equ OPERATOR_UART, 2 ** ; 1 or 2
;;; UART1 configuration
.equ BAUDRATE1, 38400 ; Serial baudrate UART1
.equ FC1_TYPE, 1 ; 1 = XON/XOFF, 2=CTS/RTS
.equ AUTOBAUD1, 0 ; 0 = to use fixed baudrate
; 1 = Autobaud, First char after reset must be 'U' (0x55)
;;; UART2 configuration
.equ BAUDRATE2, 38400 ; Serial baudrate UART2, comment if not used
.equ FC2_TYPE, 1 ; ; 1 = XON/XOFF, 2=CTS/RTS
.equ AUTOBAUD2, 0 ; 0 = to use fixed baudrate
; 1 = Autobaud, First char after reset must be 'U' (0x55)
Last edit: Randall Young 2018-08-27
Your config uses the internal oscillator What is its frequency ? 8 MHz?
There is a an external crystal @ 8 Mhz. I was suprised that the demo code did not use it explicitly.
I guess thats because the XLP demo application was focused on keeping the processor in the sleep state for power concerns and then spitting out data to the serial port at a very odd baud rate of 1,000,000 bps.
I only assume an internal frequency 8 mhz, in this condition, I haven't tested this. Where should I look? PIC24F clock setup is new to me, but easy to study however ... I guess what I should have simply asked is how to config the PIC24 to use the external crystall at 8 Mhz, to be correct for the 38,400 baud rate suggeted. I note that you do some math to the frequency to get it where you want in your code.
I would like the accuracy of the hw crystall for my application....
Last edit: Randall Young 2018-08-28
Hi,
You need to use the p24fk_config.inc file.
With the following modifications it should run at 8MHz with your chip (not tested).
Using the PLL with external crystal has not been implemented in FlashForth.
Read chapter 9, Oscillator Configuration, in the data sheet.
I see, thanks so much for the consideration of your reply, much appreciated. I will hit chapter 9 hard.
I made the code change requested. I see that you've modified the mem spec for the chip I have (PIC24F16KA102), then setup the clock to run at 8mhz. simple as possible. The comport is assigned as #2, which seems correct. However no charatcters seen out serial port. Any other suggestions relevant?
Thanks again for you time.
I found this inside the Forth Tutorial ... Building for the PIC24FV16KM202, Section 3.3
.ifdef __24FV16KM202
.print "Customize p24f16ka_config.inc for PIC24FV16KM202"
;;; Below is the setting for max amount of ram for PIC24FV16KM202
.equ FLASH_SIZE, 0x2C00 ; Flash size in bytes without the high byte
; See program memory size in the device datasheet.
.equ RAM_SIZE, 0x0800 ; Ram size in bytes
.equ EEPROM_SIZE, 0x0200 ; Eeprom size
config FOSCSEL, FNOSC_FRCDIV & SOSCSRC_ANA & LPRCSEL_LP & IESO_OFF
config FOSC, POSCMOD_NONE & OSCIOFNC_IO & POSCFREQ_MS & SOSCSEL_SOSCLP & FCKSM_CSDCMD
config FWDT, FWDTEN_ON
config FPOR, BOREN_BOR3 & RETCFG_OFF & PWRTEN_ON & I2C1SEL_PRI & BORV_V18 & MCLRE_ON**
; ICS_PGx2 for strip-board example
; ICS_PGx1 for 5V Microstick for PIC24 K-series
config FICD, ICS_PGx1
.equ FREQ_OSC, (8000000) ;Clock (Crystal)frequency (Hz)
.endif
I was thinking about doing some testing on the PIC24 5V Microstick,, and/or swapping the PIC24FV into the XLP board...
Last edit: Randall Young 2018-08-31
Or in the more recent tutorial (Jacobs, 2016)
;;; Device memory sizes. Set according to your device.
;;; You can increase the addressable flash range be decreasing the addressable ram.
;;; Below is the setting for max amount of ram for PIC24FV32KA302
.equ FLASH_SIZE, 0x5800 ; Flash size in bytes without the high byte
; See program memory size in the device datasheet.
.equ RAM_SIZE, 0x0800 ; Ram size in bytes
.equ EEPROM_SIZE, 0x0200 ; Eeprom size
; For some reason the normal config macros did not work
.pushsection FOSCSEL.sec, code
.global FOSCSEL
FOSCSEL: .pword FNOSC_FRCPLL
.popsection
; Start additions for FF Tutorial board with PIC24FV32KA30x
.pushsection FOSC.sec, code
.global FOSC
FOSC: .pword OSCIOFNC_OFF
.popsection
.pushsection FICD.sec, code
.global FICD
FICD: .pword ICS_PGx2
.popsection
; End additions
.equ FREQ_OSC, (80000004) ;Clock (Crystal)frequency (Hz)*
the PIC24FV32KA302 is a good option, just in general, cheap and powerful.