ds30 Loader free edition forums
PIC18F67J10 Bootloader at UART2 [solved] - Printable Version

+- ds30 Loader free edition forums (https://picbootloader.com/forum)
+-- Forum: Support (https://picbootloader.com/forum/forumdisplay.php?fid=3)
+--- Forum: 8-bit firmwares (https://picbootloader.com/forum/forumdisplay.php?fid=7)
+--- Thread: PIC18F67J10 Bootloader at UART2 [solved] (/showthread.php?tid=39)



PIC18F67J10 Bootloader at UART2 [solved] - vincewyh - 2011-01-21

Uart1 seems to work, but not for Uart2. Can anyone help?

;------------------------------------------------------------------------------
; Device
;------------------------------------------------------------------------------
list P=18F67J10; ;xxx


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


;------------------------------------------------------------------------------
; User preferences
;------------------------------------------------------------------------------
radix DEC

#define DEV_MODE 1 ;xxx remove or comment this line
#define OSCF 10000000 ;xxx oscillator frequency
#define BLTIME 2000 ;xxx time in ms before bootloader loads the user application
#define BLINIT 2000 ;xxx time in ms before bootloader loads the user application immediately after boot
#define HELLOTRIES 2 ;xxx number of non hello characters received before branching to the user application


;------------------------------------------------------------------------------
; UART settings
;------------------------------------------------------------------------------
#define BAUDRATE 115200 ;xxx baudrate
;#define USE_UART1 1 ;xxx uncomment to use uart1
#define USE_UART2 1 ;xxx uncomment to use uart2
#define USE_BRG16 1 ;xxx uncomment to use 16-bit brg

;#define USE_TXENABLE 1 ;xxx uncomment to use a tx enable pin
#ifdef USE_TXENABLE
#define TRISR_TXE TRISG ;xxx tris register containing tx enable
#define LATR_TXE LATG ;xxx port register containing tx enable
#define TRISB_TXE TRISG0 ;xxx tris bit for tx enable
#define LATB_TXE RG0 ;xxx port bit for tx enable
#endif


;------------------------------------------------------------------------------
; Advanced settings
;------------------------------------------------------------------------------
#define PROT_GOTO 1 ;protect goto at 0x00
#define PROT_BL 1 ;protect bootloader

#define BLPLP 2 ;bootloader placement, pages from end
#define BLSIZEP 1 ;bootloader size [pages], used by bl protection


;------------------------------------------------------------------------------
; Configuration bits, these macros can be found at the end of the inc-files located in
; C:\Program Files\Microchip\MPASM Suite\
;
; These can also be set in MPLAB IDE instead, they are found in Configure->Configuration bits...
;------------------------------------------------------------------------------
;for pic18f67j10
CONFIG WDTEN = OFF ;wathcdog timer
CONFIG STVREN = OFF ;stack over-/underflow reset
CONFIG XINST = OFF ;extended instruction set
CONFIG CP0 = OFF ;code protect
CONFIG FOSC = HS ;oscillator
;CONFIG T1DIG = OFF ;T1OSCEN enforcement
;CONFIG LPT1OSC = OFF ;low-power timer1 oscillator
CONFIG FCMEN = OFF ;fail-safe clock monitor
CONFIG IESO = OFF ;nternal External Oscillator Switch Over Mode
CONFIG WDTPS = 1 ;watchdog postscaler
;CONFIG DSWDTOSC= INTOSCREF ;dswdt clock select
;CONFIG RTCOSC = INTOSCREF ;rtcc clock select
;CONFIG DSBOREN = OFF ;deep sleep bor
;CONFIG DSWDTEN = OFF ;deep sleep watchdog timer
;CONFIG DSWDTPS = 2 ;deep sleep watchdog postscaler
;CONFIG IOL1WAY = OFF ;iolock one-way set enable bit
;CONFIG MSSP7B_EN=MSK5 ;mssp address masking
;CONFIG WPFP = PAGE_0 ;write/Erase Protect Page Start/End Location:
;CONFIG WPEND = PAGE_0 ;write/Erase Protect Region Select bit (valid when WPDIS = 0):
;CONFIG WPCFG = OFF ;write/Erase Protect Configuration Region
;CONFIG WPDIS = OFF ;write Protect Disable bit


RE: PIC18F67J10 Bootloader at UART2 - Mikael Gustavsson - 2011-01-21

Which firmware version do you use?


RE: PIC18F67J10 Bootloader at UART2 - vincewyh - 2011-01-21

From ds30_Loader_110115.zip


RE: PIC18F67J10 Bootloader at UART2 - Mikael Gustavsson - 2011-01-21

joeausro's fix is included in the latest package. It should work.

joeausro: do you mind testing the version in the latest package?
[broken link]


RE: PIC18F67J10 Bootloader at UART2 - vincewyh - 2011-01-25

(2011-01-21, 21:36:39)Mikael Gustafsson Wrote: joeausro's fix is included in the latest package. It should work.

I've downloaded the latest package and tried it again, didn't work. Now I see why it didn't work for UART2. The registers were not updated accordingly:

In the Send() function, needs modification on 2 lines:
movwf UTXREG ;movwf TXREG
txwait btfss UTXSTA, TRMT ;txwait btfss TXSTA, TRMT

In the Receive() function, needs modification on 1 line:
movf URCREG,w ;movf RCREG, w

Not it works after the fix.


RE: PIC18F67J10 Bootloader at UART2 - Mikael Gustavsson - 2011-01-25

Thank you very much for the feedback, much appreciated!
I will include this in the next release


RE: PIC18F67J10 Bootloader at UART2 - vincewyh - 2011-01-28

(2011-01-25, 20:02:20)Mikael Gustafsson Wrote: Thank you very much for the feedback, much appreciated!
I will include this in the next release

You are most welcome! Keep up the good job!