CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Alternative RX/TX Pins on DsPIC30F4012

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
younder



Joined: 24 Jan 2013
Posts: 53
Location: Brazil

View user's profile Send private message

Alternative RX/TX Pins on DsPIC30F4012
PostPosted: Fri Jan 10, 2020 7:09 pm     Reply with quote

Hello guys,

Is it possible to use Hardware UART module in other pins different than alternative RC13 (U1ATX) and RC14 (U1ARX) as per datasheet? I tried the options below, with the following results:

Compiler V5.092

Code:

#include <30F4012.h>
#use delay(Internal=117964800) // Internal 7.3728Mhz * FRC_PLL16 = 117964800Hz
#fuses FRC_PLL16,NOPROTECT,NOWRT,MCLR,PUT64,NOCKSFSM,BORV27,NODEBUG,NOWDT
#build (stack=256) // 128,256,384 or 512 depending how big the code is


Using original UART TX/RX Pins (OK, everything is working!):
Code:

#use rs232 (UART1, baud=9600,parity=N, bits=8, stop=1,ERRORS)


Using alternative pins as per datasheet (OK, everything is working!):
Code:

#use rs232 (baud=9600,parity=N,xmit=PIN_C13,rcv=PIN_C14,bits=8,stop=1,ERRORS)


Using other pins (Only TX Working, RX ISR not working!):
Code:

#use rs232 (baud=9600,parity=N,xmit=PIN_E4,rcv=PIN_E5,bits=8,stop=1,ERRORS)


and then:
Code:

   enable_interrupts(INT_RDA);
   enable_interrupts(INTR_GLOBAL);


If anyone can help me understand why with Pins E4/E5 only TX works I would really appreciate! I check Hardware, all is fine as you can see that with original pins I have no problem with TX, RX, ISR, etc.

Hugo
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jan 10, 2020 9:05 pm     Reply with quote

While I've never used that PIC , I suspect it may have 'alternate pin configuration' via a register or PPS.
A read of the datasheet , UART chapter, will tell what to do...
then consult CCS the device header file for the proper terminology to implement.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 10, 2020 9:15 pm     Reply with quote

I see nothing in the PIC data sheet that says you can put a hardware
UART on pins E4 and E5. The logical explanation for your results is that
CCS is creating a software UART on those pins. Hence, no Rx interrupt.
Ttelmah



Joined: 11 Mar 2010
Posts: 19510

View user's profile Send private message

PostPosted: Sat Jan 11, 2020 1:12 am     Reply with quote

At he end of the day, the chip can only do what it's hardware supports.

You refer to the datasheet. In this it clearly tells you that UART1 can
connect to pins F2/F3 or C13/14. Nowhere else. There is no 'magic'
allowing you to use other pins. If you specify pins that the hardware
UART can't connect to, then the compiler generates a software UART, which
implies no INT_RDA, and half duplex operation.

The compiler can't do what the chip doesn't support.

If you want to use these other pins, then change chips to one of the later
ones with PPS, and check that the pins involved do support this. However
be aware that most of these chips have slightly different layouts, having
an extra Vcore pin, so you lose one I/O pin and have to add the capacitor
for this.
younder



Joined: 24 Jan 2013
Posts: 53
Location: Brazil

View user's profile Send private message

PostPosted: Sat Jan 11, 2020 8:12 am     Reply with quote

Thank you all for the responses... it's clear now that with Software UART the Isr will not work. I will have to change the pins in my project.
_________________
Hugo Silva
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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