PIC18F25K22 UART1 failed to receive data on RX pin

Beta Testing discussion on mikroBasic PRO for PIC.
Post Reply
Author
Message
hunghp1980
Posts: 3
Joined: 04 Nov 2015 00:20

PIC18F25K22 UART1 failed to receive data on RX pin

#1 Post by hunghp1980 » 04 Nov 2015 00:40

Hi, I am currently using the PIC ready 28 pin board with pic18f25k22... UART1 tx is working but not rx. I have set all the pin on PORTC to digital as well.

Please have a look at the simple code below, please see if I am missing anything. I've try my chip on Hi Tech compiler and it works. Maybe I need to enable Global Interrupt and enable peripheral? However, if I am using UART2 then it works. A little confused, please help.

Code: Select all

void main() {
      ANSELC = 0b00000000; // set all digital
      TRISC = 0b10000001; //PORTc.B6 as output RX,  B7 as input for Rx
      
      UART1_Init(9600);
      Delay_ms(100);

      UART1_Write_Text("COM1 Ready...\n");
      
      while(1) {
         if(UART1_Data_Ready()) {
           UART1_Write(UART1_Read());
         }
      }
}
Thanks

User avatar
aleksa.jovanovic
Posts: 526
Joined: 30 Jun 2015 08:48

Re: PIC18F25K22 UART1 failed to receive data on RX pin

#2 Post by aleksa.jovanovic » 04 Nov 2015 13:31

Hi,

I've tried out the example and it works.
Please check the connections and the RS232 transceiver or the ftdi usb serial chip

Best regards,
Aleksa

hunghp1980
Posts: 3
Joined: 04 Nov 2015 00:20

Re: PIC18F25K22 UART1 failed to receive data on RX pin

#3 Post by hunghp1980 » 04 Nov 2015 20:00

Perfect, as you mention to check the FT232RL chip on the Ready board, I realized that the RC7/RX line is share with my own external FT232 chip, after removing jumper (J2, 0-ohm resistor), I am able to communicate to my own FT232 chip. Could this be the problem?


Thanks a lot.

User avatar
aleksa.jovanovic
Posts: 526
Joined: 30 Jun 2015 08:48

Re: PIC18F25K22 UART1 failed to receive data on RX pin

#4 Post by aleksa.jovanovic » 06 Nov 2015 11:06

Hi,

So it works when you use your own chip, but not with the one on-board?
Is there anything else connected to it by accident ?

Best regards,
Aleksa

hunghp1980
Posts: 3
Joined: 04 Nov 2015 00:20

Re: PIC18F25K22 UART1 failed to receive data on RX pin

#5 Post by hunghp1980 » 12 Nov 2015 02:03

Hi Aleksa,

No, there were nothing else connected to it except my mikroProg programmer. When I remove the jumper J2 on the Ready Board, it works. Basically the PIC18F25K22 was able to use UART1 to transmit and receive data with the PC through a USB to serial adapter using RC6 and RC7 pins. The USB to serial adapter also uses a FT232RL chip. By removing jumper J2 on the Ready Board, it is no longer share the same line with the FT232RL of the Ready Board, strange but it works.

Thanks,
Hung

User avatar
aleksa.jovanovic
Posts: 526
Joined: 30 Jun 2015 08:48

Re: PIC18F25K22 UART1 failed to receive data on RX pin

#6 Post by aleksa.jovanovic » 13 Nov 2015 12:13

Hi,

I believe that the FT232 chip has some internal pull up resistors for the tx/rx lines so that is why maybe when you disconnected it it started working.
But it is strange that the FT232 chip on the ready board doesn't work in both ways, was it always like this?
Do you have the possibility to change that chip if faulty?

Best regards,
Aleksa

Post Reply

Return to “mikroBasic PRO for PIC Beta Testing”