![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
younder
Joined: 24 Jan 2013 Posts: 53 Location: Brazil
|
Alternative RX/TX Pins on DsPIC30F4012 |
Posted: Fri Jan 10, 2020 7:09 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9176 Location: Greensville,Ontario
|
|
Posted: Fri Jan 10, 2020 9:05 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jan 10, 2020 9:15 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19375
|
|
Posted: Sat Jan 11, 2020 1:12 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
younder
Joined: 24 Jan 2013 Posts: 53 Location: Brazil
|
|
Posted: Sat Jan 11, 2020 8:12 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|