I try to use FF30 / V4.8 on a PIC24FJ64GA002. All is well (so far) as long as I don't include the UART2, i.e. remove the comment from
";.equ BAUDRATE2, 4800"
in p24f_config.inc
If I enable the UART2 "normal" words, ex. "words", "idle" etc., even things like "1 drop" work normal as long as there is nothing left on the stack - ff answers alsways with
" ok <#,ram> "
but as soon as there's something left on the stack forth will get into an endless loop which start with
" okø
þ
þ
þ
þ
þ
þ
þ
þ
þ"
...
I'm quite out of my home water here, any help would be appreciated.
I've added the p24f_config.inc file here i case somebody sees an obvious misconfiguration mistake:
;;; UART2 configuration
.equ BAUDRATE2, 4800 ; Serial baudrate UART2, comment if not used
.equ FC2_TYPE, 0 ; ; 1 = XON/XOFF, 2=CTS/RTS
.equ AUTOBAUD2, 0 ; 0 = to use fixed baudrate
; 1 = Autobaud, First char after reset must be 'U' (0x55)
; Set to one to use the alternate UART pins
.equ USE_ALTERNATE_UART_PINS, 0
; Default number base
.equ BASE_DEFAULT, 10 ; 16 = hexadecimal, 10 = decimal
; Set to 1 for power save when CPU is idle
.equ IDLE_MODE, 1
; Set to 1 for CPU load measurement
.equ CPU_LOAD, 1
; CPU load indicator led definitions
.equ CPU_LOAD_LED, 1 ; set to 0 to disable
.equ CPU_LOAD_TRIS, TRISB
.equ CPU_LOAD_PORT, LATB
.equ CPU_LOAD_BIT, 15
.equ CPU_LOAD_LED_POLARITY, 1 ; 0 = low on port turns on led, 1 = high on port turns on led
; Define the startup delay for turnkey words. Milliseconds
.equ TURNKEY_DELAY, 2000 ; milliseconds
; UART buffer sizes
.equ TX1_BUF_SIZE, 16
.equ RX1_BUF_SIZE, 64
.equ RX1_OFF_FILL, 48 ; Fill level for XOFF
.equ TX2_BUF_SIZE, 16
.equ RX2_BUF_SIZE, 32
.equ RX2_OFF_FILL, 16 ; Fill level for XOFF
;;; USER AREA sizes for the OPERATOR task
.equ RETURN_STACK_SIZE, 96 ; 48 cells return stack
.equ PARAMETER_STACK_SIZE, 96 ; 48 cells parameter stack
.equ TIB_SIZE, 74 ; 74 chars tib size
.equ HOLD_SIZE, 10 ; 10 chars hold area
;;; Storage space for OPERATOR uservariables 2 and upwards
;;; EXAMPLE: 8 user myUserVar -> define UADDSIZE 8
.equ UADDSIZE, 8
; Set to 1 for extra debug info after an exception reset
.equ DEBUG_INFO, 0
; Set to 1 to see when FF writes to flash and eeprom
; 'F' is printed before each flash write.
; 'E' is printed before each eeprom write
.equ DEBUG_FLASH, 0
; Write method 1 writes to flash always before the prompt. -> Robust. More wear on the flash
; - Recommended for all chips if delays between characters is large.
; - Recommended for dsPIC30F and PIC24F16KAxxx.
; Write method 2 writes to flash when needed and after WRITE_TIMEOUT ms timeout.-> Less Robust.Less wear on the flash
; - Pretty good for dsPIC33 and for PIC24 with large flash block size.
; - NOT WORKING CASE: If a word is executed that starts on the prevoius flash page
; and it continues on the current flash page which has not yet been written to flash,
; a reset will occur.
.equ WRITE_METHOD, 1
.equ WRITE_TIMEOUT, 500
; Set to 1 to allow control-o to reset FlashForth
.equ CTRL_O_WARM_RESET, 0
;;; Memory mapping prefixes
;;; To be set to the amount of ram + 0x800.
;;; The rest if the memory space is available for flash
;;; You can increase the addressable flash range be decreasing the addressable ram.
;;; Below is the setting for max amount of ram for dsPIC24HJ128GP502
.equ PFLASH, 0x1000 ; 4 Kbytes RAM 60 Kbyte flash
There is one thing to try first.
The ASM30 and the XC16 compiler have a strange bug, which causes faulty code generation in random places.
The workaround is to enable generation of the assembler listing file in the compiler.
It could help.
You could also try the FF5.0 pre-release code from git with
git clone git://git.code.sf.net/p/flashforth/code flashforth-code
BR Mikael
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the quick reply, Mikael. Well, yes, I ran into the XC16 bug already and enabled every and all listing include options of the assembler. All in all the code seems to work but for the status message after the ok.
Thanks for the link to FF5.0 - i'll try that asap.
Greetings
Holger
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, that's it! I hoped it might have benn a bad configuration but as I already said I'm way out of my knowledge here.
Super! Perfect!
Ok, I might sound a bit overreacting now, but the combination of XC16 bugs, linux software mentality and bluetooth dongle specialities frayes my nerves for two months now.
Thanks a lot!
Holger
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I try to use FF30 / V4.8 on a PIC24FJ64GA002. All is well (so far) as long as I don't include the UART2, i.e. remove the comment from
";.equ BAUDRATE2, 4800"
in p24f_config.inc
If I enable the UART2 "normal" words, ex. "words", "idle" etc., even things like "1 drop" work normal as long as there is nothing left on the stack - ff answers alsways with
" ok <#,ram> "
but as soon as there's something left on the stack forth will get into an endless loop which start with
" okø
þ
þ
þ
þ
þ
þ
þ
þ
þ"
...
I'm quite out of my home water here, any help would be appreciated.
I've added the p24f_config.inc file here i case somebody sees an obvious misconfiguration mistake:
<start of="" configuration="" file=""></start>
;;; FlashForth device configuration for the PIC24F
config __CONFIG1, WDTPS_PS8192 & WINDIS_ON & FWDTEN_OFF & COE_OFF & BKBUG_ON & GWRP_OFF & GCP_OFF & JTAGEN_OFF & ICS_PGx1
config __CONFIG2, POSCMOD_XT & I2C1SEL_PRI & IOL1WAY_OFF & OSCIOFNC_ON & FCKSM_CSDCMD & FNOSC_PRI & SOSCSEL_LPSOSC & WUTSEL_FST & IESO_OFF
.equ FREQ_OSC, (7372800) ;Clock (Crystal)frequency (Hz)
.equ FCY, (FREQ_OSC/2)
;;; no EEPROM for p24fxxxx
; #define PEEPROM
;;; UART1 configuration
.equ BAUDRATE1, 19200 ; Serial baudrate UART1
.equ FC1_TYPE, 0 ; 1 = XON/XOFF, 2=CTS/RTS
.equ AUTOBAUD1, 0 ; 0 = to use fixed baudrate
; 1 = Autobaud, First char after reset must be 'U' (0x55)
;;; Peripheral pin mapping
.ifdecl RPINR18
.equ U1RXPIN, 0x2 ;
.equ RPINR18VAL, 0x0402 ; (U1CTS <<16 + U1RXPIN) -> pins RP4 + RP2
.equ U1TXPIN, 0x3
.equ U1RTSPORT, LATB
.equ U1RTSTRIS, TRISB
.equ U1RTSPIN, 0x5
.endif
;;; UART2 configuration
.equ BAUDRATE2, 4800 ; Serial baudrate UART2, comment if not used
.equ FC2_TYPE, 0 ; ; 1 = XON/XOFF, 2=CTS/RTS
.equ AUTOBAUD2, 0 ; 0 = to use fixed baudrate
; 1 = Autobaud, First char after reset must be 'U' (0x55)
;; peripheral pin mapping
.ifdecl RPINR19
.equ U2RXPIN, 0xA ;
.equ RPINR19VAL, 0x000A ; (U1CTS <<16 + U1RXPIN) -> pins RP0 + RP10
.equ U2TXPIN, 0xB
.equ U2RTSPORT, LATB
.equ U2RTSTRIS, TRISB
.equ U2RTSPIN, 0x5
.endif
; Set to one to use the alternate UART pins
.equ USE_ALTERNATE_UART_PINS, 0
; Default number base
.equ BASE_DEFAULT, 10 ; 16 = hexadecimal, 10 = decimal
; Set to 1 for power save when CPU is idle
.equ IDLE_MODE, 1
; Set to 1 for CPU load measurement
.equ CPU_LOAD, 1
; CPU load indicator led definitions
.equ CPU_LOAD_LED, 1 ; set to 0 to disable
.equ CPU_LOAD_TRIS, TRISB
.equ CPU_LOAD_PORT, LATB
.equ CPU_LOAD_BIT, 15
.equ CPU_LOAD_LED_POLARITY, 1 ; 0 = low on port turns on led, 1 = high on port turns on led
; Define the startup delay for turnkey words. Milliseconds
.equ TURNKEY_DELAY, 2000 ; milliseconds
; UART buffer sizes
.equ TX1_BUF_SIZE, 16
.equ RX1_BUF_SIZE, 64
.equ RX1_OFF_FILL, 48 ; Fill level for XOFF
.equ TX2_BUF_SIZE, 16
.equ RX2_BUF_SIZE, 32
.equ RX2_OFF_FILL, 16 ; Fill level for XOFF
;;; USER AREA sizes for the OPERATOR task
.equ RETURN_STACK_SIZE, 96 ; 48 cells return stack
.equ PARAMETER_STACK_SIZE, 96 ; 48 cells parameter stack
.equ TIB_SIZE, 74 ; 74 chars tib size
.equ HOLD_SIZE, 10 ; 10 chars hold area
;;; Storage space for OPERATOR uservariables 2 and upwards
;;; EXAMPLE: 8 user myUserVar -> define UADDSIZE 8
.equ UADDSIZE, 8
; Set to 1 for extra debug info after an exception reset
.equ DEBUG_INFO, 0
; Set to 1 to see when FF writes to flash and eeprom
; 'F' is printed before each flash write.
; 'E' is printed before each eeprom write
.equ DEBUG_FLASH, 0
; Write method 1 writes to flash always before the prompt. -> Robust. More wear on the flash
; - Recommended for all chips if delays between characters is large.
; - Recommended for dsPIC30F and PIC24F16KAxxx.
; Write method 2 writes to flash when needed and after WRITE_TIMEOUT ms timeout.-> Less Robust.Less wear on the flash
; - Pretty good for dsPIC33 and for PIC24 with large flash block size.
; - NOT WORKING CASE: If a word is executed that starts on the prevoius flash page
; and it continues on the current flash page which has not yet been written to flash,
; a reset will occur.
.equ WRITE_METHOD, 1
.equ WRITE_TIMEOUT, 500
; Set to 1 to allow control-o to reset FlashForth
.equ CTRL_O_WARM_RESET, 0
;;; Memory mapping prefixes
;;; To be set to the amount of ram + 0x800.
;;; The rest if the memory space is available for flash
;;; You can increase the addressable flash range be decreasing the addressable ram.
;;; Below is the setting for max amount of ram for dsPIC24HJ128GP502
.equ PFLASH, 0x1000 ; 4 Kbytes RAM 60 Kbyte flash
;;; Memory control defines
.equ FLASH_ERASE, 0x4042 ; Erase one row (1024/1596 bytes)
.equ FLASH_WRITE, 0x4001 ; Write one row (128/196 bytes)
.equ FLASH_WRITE_SINGLE, 0x4003;Memory word program
.equ PAIVT, 0x100
.equ IBUFSIZEL, 0x0400
.equ IBUFSIZEH, 0x0200
.equ IBUFLEN1, 0x0040 ; Inner write loop
.equ IBUFLEN2, 0x0008 ; Outer write loop
.equ IBUFMASK, 0xfc00
.equ MS_PR_VAL, (FCY/1000) ; Timer value for 1 ms ticks
.equ BAUD_DIV1, (FCY/4/BAUDRATE1)-1 ; UART1 divisor
.ifdecl BAUDRATE2
.equ BAUD_DIV2, (FCY/4/BAUDRATE2)-1 ; UART2 divisor
.endif
.equ write_delay, 20 ; Flash write delay
<end of="" file=""></end>
Thanks
H. Apfel
Hi,
I dont have that problem on my pic24hj128.
There is one thing to try first.
The ASM30 and the XC16 compiler have a strange bug, which causes faulty code generation in random places.
The workaround is to enable generation of the assembler listing file in the compiler.
It could help.
You could also try the FF5.0 pre-release code from git with
git clone git://git.code.sf.net/p/flashforth/code flashforth-code
BR Mikael
Thanks for the quick reply, Mikael. Well, yes, I ran into the XC16 bug already and enabled every and all listing include options of the assembler. All in all the code seems to work but for the status message after the ok.
Thanks for the link to FF5.0 - i'll try that asap.
Greetings
Holger
Actually I just now started testing the 5.0 with PIC24 and I have changed the XOFF logic. There are some flow control problems there.
The flow control problem required optimization of the RX buffer XOFF fill level from 4 to 8 characters. The 5.0 prerelease should work now.
BR Mikael
This could be the problem:
.equ PFLASH, 0x1000 ;
It should be
.equ PFLASH 0x2800 ; 8 KB ram, 2 Kb registers, 54 Kb flash,
With the smaller setting the FF user area spills over to flash memory!!!!!
Sorry for that. I will change the default PFLASH default values.
BR Mikael
Yes, that's it! I hoped it might have benn a bad configuration but as I already said I'm way out of my knowledge here.
Super! Perfect!
Ok, I might sound a bit overreacting now, but the combination of XC16 bugs, linux software mentality and bluetooth dongle specialities frayes my nerves for two months now.
Thanks a lot!
Holger