Hello,

I'm building a multifunctional board (just like Arduino UNO or so) with the PIC18F25K80 and I'm willing to program the Tiny Multi Bootloader+ on it.

When I first flashed the micro with the bootloader it woulnd't work, but then I changed the IRCF bits as follows and it worked (at least, the bootloader software recognized the micro):

What is on the bootloader:
[...]
IntrareBootloader:
;skip TRIS to 0 C6
bsf OSCCON,IRCF0 ;int clock 16MHz
movlw ((1<<TXEN) | (1<<BRGH)) ;init serial port
movwf _TXSTA
;use only SPBRG (8 bit mode default) not using BAUDCON
movlw spbrg_value
[...]

What I changed:

[...]
IntrareBootloader:
;skip TRIS to 0 C6
bsf OSCCON,IRCF0 ;int clock 16MHz
bsf OSCCON,IRCF1 ;int clock 16MHz
bsf OSCCON,IRCF2 ;int clock 16MHz
movlw ((1<<TXEN) | (1<<BRGH)) ;init serial port
movwf _TXSTA
;use only SPBRG (8 bit mode default) not using BAUDCON
movlw spbrg_value
[...]

I did this in order to get the real 16MHz of clock frequency, according to the datasheet.

After this, the software provided with the bootloader started recognizing the micro at BR = 19200.

The problem is that I am trying to flash this piece of code into de micro:

include <xc.h>

include <p18f25k80.h>

void main(void) {

OSCCONbits.IRCF0 = 1;
OSCCONbits.IRCF1 = 1;
OSCCONbits.IRCF2 = 1;

BAUDCON1bits.BRG16 = 0;                       //8bit Baud Rate generator
TXSTA1bits.BRGH = 0;                          //Low speed BR.
SPBRG = 51;                                   //Writing SPBRG Register
TXSTA1bits.SYNC = 0;                          //Setting Asynchronous Mode, ie UART
RCSTA1bits.SPEN = 1;                          //Enables Serial Port
TRISC7 = 1;                                   //As Prescribed in Datasheet
TRISC6 = 1;                                   //As Prescribed in Datasheet
RCSTA1bits.CREN = 1;                          //Enables Continuous Reception
TXSTA1bits.TXEN = 1;                          //Enables Transmission

while(1){
while(!TXSTA1bits.TRMT);
TXREG1 = 'a';
}
}

And I get random values when I check the received data... (I use CoolTerm for MAC at BR=4800, according to the clock and BR configuration).

I use the XC8 Compiler, so I shouldn't need to add extra code to my program, but I am not sure if I'm missing something obvious, and I am breaking my heat off trying useless things that may never work.

So, I would really appreciate some help with that!

Thank you very much in advance.