Page 1 of 1

PIC18F26K22 EUSART 2 not working

Posted: Wed Dec 12, 2012 10:32 am
by leoo
Hello,

I have currently tried switching to the 18F26K22 chip because I need to talk to 2 RS232 peripherals and with this chip all the peripheral comms (USART 1 and 2 and SPI, etc) are on dedicated pins.The EUSART 1 works with no problems, but I cannot get the second EUSART to work. (I have also seen that the IOC (RB7:RB4) does not work).

The original project using 2 x RS232 (using a tri-state buffer to select between 2 RS232 devices), SPI, IOC, RXINT and INT0) worked OK on the 16F877A, but it only has 1 USART and no interrupt priority, etc, so I need to change chips.

Can you please offer some assistance on getting the (seems like port B) comms and interrupts sorted?

Kind regards.
Leo

Re: PIC18F26K22 EUSART 2 not working

Posted: Wed Dec 12, 2012 1:09 pm
by Benj
Hello Leo,

I have had a look at the code and it seems to be ok. I'm guessing it is compiling correctly for you.

Please could you post up a very simple program using UART2 and also include the generated C file and I will check this for you.

Re: PIC18F26K22 EUSART 2 not working

Posted: Wed Dec 12, 2012 5:34 pm
by leoo
Hi Ben,

Thanks for the response. Attached is the Flowcode and generated C files. I haven't included code for the IOC for the second EUSART.

Kind regards.
Leo
18F26K22 2xEUSART and Int.c
(36.77 KiB) Downloaded 418 times
18F26K22 2xEUSART and Int.fcf
(7.5 KiB) Downloaded 376 times

Re: PIC18F26K22 EUSART 2 not working

Posted: Fri Dec 14, 2012 9:03 am
by leoo
Hi Ben, Have you had a chance to look at the attached files?

Kind regards.
Leo

Re: PIC18F26K22 EUSART 2 not working

Posted: Fri Dec 14, 2012 10:59 am
by Sefi
Hi Leo,

Are you using the EB006 development board and the ICSP programming pins to program the chip?

If that is the case then you will need to move the ICSP jumper to the USB side after programming the chip to make pins 6 & 7 of port B reconnect with the output. I suspect this is what your problem is. The way the EB006 is designed is that when using the ICSP pins to program the chip the jumper disconnects pins 6 & 7 of port B.

Give this a go.

cheers
Sei

Re: PIC18F26K22 EUSART 2 not working

Posted: Fri Dec 14, 2012 1:08 pm
by leoo
Hi Sei,

Thanks for responding. I have already done as you suggested, but this makes no difference.

I have checked and rechecked everything I know to check on the hardware side. Unfortunately my knowledge of C is extremely limited, but I've even tried to check whether there is an obvious error in the FCD file.

Ben has said that he would have a look at the code I posted to see if he can pick up anything untowards.

Kind regrads.
Leo

Re: PIC18F26K22 EUSART 2 not working

Posted: Fri Dec 14, 2012 2:08 pm
by Sefi
Hi Leo,

I have looked at the generated code and it seems that the UART port definitions are correct being ports C & B with pins 6 and 7 for transmit and receive. However, the RS232 port definitions show PortA pin 0 as TX and RX which is very odd. The RS232 is actually in the CAL layer and its port addresses are passed in so there must be some issue there. Both instances of the RS232 component are showing the TX_PORT as Porta and the TX and RX pins as pin 0 with CTS and RTS showing on PortC which is very odd as these settings are passed into this component. However, what I have just said is the way things work in FC5 and I just noticed you are using FC4 in which the CAL layer did not exist (if I remember correctly).

I will see if I have FC4 loaded on a machine and will have a quick look later, unless Ben comes back in the meantime.

regards
Sefi