2011-12-26, 00:54:54
(This post was last modified: 2012-12-25, 17:03:39 by Mikael Gustavsson.)
Hi!
Im in the process of trying out your bootloader. looks to be the most complete loader i have seen for PIC.
I have a problem:
The Gui reports "Found unknown device id " when connection to my 2-wire RS485 device. I know the HW is OK, because i have run Modbus at the same speed on it.
The device is a 12F1840 unit.
Configurations are set in code.
Through stepping i have concluded that the spbrg is calculated correctly.
Any suggestions?
This is my settings:
and my user code in the loader:
Im in the process of trying out your bootloader. looks to be the most complete loader i have seen for PIC.
I have a problem:
The Gui reports "Found unknown device id " when connection to my 2-wire RS485 device. I know the HW is OK, because i have run Modbus at the same speed on it.
The device is a 12F1840 unit.
Configurations are set in code.
Through stepping i have concluded that the spbrg is calculated correctly.
Any suggestions?
This is my settings:
Code:
;------------------------------------------------------------------------------
; Device
;------------------------------------------------------------------------------
LIST P=12F1840
;------------------------------------------------------------------------------
; Includes
;------------------------------------------------------------------------------
#include "devices.inc"
;------------------------------------------------------------------------------
; User preferences
;------------------------------------------------------------------------------
radix DEC
#define FOSC 1000000 ;xxx
#define BLTIME 5000 ;xxx time in ms before bootloader loads the user application
#define HELLOTRIES 2 ;xxx number of non hello characters received before branching to the user application
;------------------------------------------------------------------------------
; UART settings
;------------------------------------------------------------------------------
#define USE_UART1 1 ;xxx uncomment to use uart1
;#define USE_UART2 1 ;xxx uncomment to use uart2
#define BAUDRATE 19200 ;xxx baudrate
;#define USE_ABAUD 1 ;xxx auto baud rate detection, only available on enhanced mid-range devices(?)
#define USE_BRGH 1 ;xxx
#define USE_BRG16 1 ;xxx 16-bit brg, only available on enhanced mid-range devices(?)
#define USE_TXENABLE 1 ;xxx uncomment to use a tx enable pin
#ifdef USE_TXENABLE
#define TRISR_TXE TRISA ;xxx tris register containing tx enable
#define PORTR_TXE PORTA ;xxx port register containing tx enable
#define TRISB_TXE TRISA0 ;xxx tris bit for tx enable
#define PORTB_TXE RA0 ;xxx port bit for tx enable
#endif
;------------------------------------------------------------------------------
; Advanced settings
;------------------------------------------------------------------------------
#define BLPLW 256 ;bootloader placement, words from end, should be a multiple of 64
;------------------------------------------------------------------------------
; 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...
;------------------------------------------------------------------------------
; Enhanced
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _BOREN_OFF & _IESO_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _PLLEN_OFF & _LVP_OFF
and my user code in the loader:
Code:
;------------------------------------------------------------------------------
; User specific entry code go here
;------------------------------------------------------------------------------
; Set internal oscillator to 1MHz
banksel OSCCON
bsf OSCCON, IRCF0
bsf OSCCON, IRCF1
bcf OSCCON, IRCF2
bsf OSCCON, IRCF3
;IO
banksel TRISA
movlw B'10110'
movwf TRISA
;weak pullup
banksel WPUA
movlw 0
movwf WPUA
;assign uart to the correct pins
banksel APFCON
movlw B'10000100'
movwf APFCON