|
|
View previous topic :: View next topic |
Author |
Message |
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
Help troubleshooting serial comm issue |
Posted: Fri Oct 10, 2014 12:18 am |
|
|
I'm having a devil of a time tracking down a problem here.
I've got one board with a PIC18F26J50, code written with PICC 5.025. It's an existing product, works fine. I'm trying to get it to talk to a new board with a PIC16F1847. I have the '26J50 serial EUSART set up like this:
Code: |
#pin_select U2RX=PIN_B4
#pin_select U2TX=PIN_B3
#use rs232(STREAM=GPS,BAUD=9600,PARITY=N,UART2,ERRORS,RECEIVE_BUFFER=128)
|
The new board with the 16F1847 is sending serial data directly connected -- at the moment it's all on the workbench, no more than 4" of wire between the two. No level converters or anything, 16F1847 TxD wired directly to 18F26J50 RxD (pin 25, RB4).
With the 18F26J50 removed from the board, I get a nice clean 0V - 3.3V serial data stream from the 16F1847, checked all the way from the '1847 to the '26J50 socket. With the 18F26J50 plugged in and powered on, my serial data swings from 2.3V to 3.3V (as in, it never goes below 2.3V). Needless to say, no data is received. It's acting like the 18F26J50 is trying to drive pin B4 high, but I have nothing I can find telling it to do so. In fact, I even tried this:
Code: | #use fast_io(B)
set_tris_b(0xB4);
port_b_pullups(0xEF); |
No change. I even swapped the chip for a new one, thinking perhaps I'd damaged an output buffer. That wasn't it. I rigged up a pull-down using a 1K Ohm resistor; that made only a few mV difference
Suggestions? Are there any known bugs using PPS and/or ESUART2 on the 18F26J50? I didn't see anything in the Microchip data sheet or errata. This is kind of a head scratcher. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Fri Oct 10, 2014 1:33 am |
|
|
Start by making sure you have:
setup_spi(SPI_DISABLED);
This peripheral has priority over the relocatable peripheral functions, so you need to make sure it is off.
I've been using the 26J50, with PPS, for a long time without problems. I use B4, for SCK2 on the second SPI, and B2/B3 for UART2:
Code: |
#pin_select TX2=PIN_B2
#pin_select RX2=PIN_B3 //Uart 2
#pin_select P1A=PIN_C1
#pin_select P2A=PIN_C2
#pin_select CCP1=PIN_C1 //PWM1
#pin_select CCP2=PIN_C2 //PWM2
#pin_select SDO2=PIN_B6
#pin_select SDI2=PIN_B5
#pin_select SCK2=PIN_B4 //SPI2 for SD card
#use rs232(baud=9600,parity=N,UART1,bits=8,stream=PORT1,errors) //head
#use rs232(baud=57600,parity=N,UART2,bits=8,stream=PORT2,BRGH1OK,errors) //controller
|
I do have spi1 disabled though.
Best Wishes |
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Fri Oct 10, 2014 11:30 am |
|
|
As it turns out, I was looking in the wrong place. The fault was in my USB bootloader. When I compiled for standalone operation and burned the chip, it worked as designed. I needed to re-compile the bootloader with the newer .h file.
In the bootloader I found I had IOL1WAY set and it would refuse to overwrite the bootloader itself or the config words... so the pin assignments never got activated, which was what it was acting like. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|