Regarding setting the regs directly: this is what I've tried (note this is set to 115200 baud as that was the original objective)
Code:
OSCFRQ = %1000 '64Mhz
Define OSC 64
PRECISION CON 8 SYSTEM '8 byte = 64 bit precision
INCLUDE "N-Bit_Math.pbp"
'Use for hardware serial comms to SD card module
'******************************************************************************
'Configure UART Control Register 0
U2CON0.7 = 1 'BRGS = 1 (high speed baud generator)
U2CON0.6 = 0 'ABDEN = 0 Auto-baud Detect Disabled
U2CON0.5 = 1 'TXEN: Transmit Enabled
U2CON0.4 = 1 'RXEN: Receive Disabled
U2CON0.3 = 0 '0000 = Asynchronous 8-bit UART mode
U2CON0.2 = 0 '0000 = Asynchronous 8-bit UART mode
U2CON0.1 = 0 '0000 = Asynchronous 8-bit UART mode
U2CON0.0 = 0 '0000 = Asynchronous 8-bit UART mode
U2CON1.7 = 0 'Turn Serial port 2 off for baud setting
U2BRGL = 138 'Baud Divisor low byte
U2BRGH = 0 'Baud Divisor high byte
U2RXPPS = %1011 'Assign UART RX pin to RB3
RB0PPS = %010110 'Assign UART2 TX pin to RB0
U2CON1.7 = 1 'Turn Serial port 2 on
'******************************************************************************
'Configure AN2 as Analog Inputs (PortA2)
ANSELB = %00000000 'Everything Digital
TRISB.0 = 0 'SD_Card_TX Hardware UART
TRISB.3 = 1 'SD_Card_RX Hardware UART
hSerout2 ["Test",13,10]
That doesn't provide any joy either.
Bookmarks