Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PIC18F67J10 Bootloader at UART2 [solved]
#1
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
Reply
#2
Which firmware version do you use?
Reply
#3
From ds30_Loader_110115.zip
Reply
#4
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]
Reply
#5
(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.
Reply
#6
Thank you very much for the feedback, much appreciated!
I will include this in the next release
Reply
#7
(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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)