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

4th UART interrupt not working

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



Joined: 30 Aug 2005
Posts: 155
Location: Calgary, AB

View user's profile Send private message

4th UART interrupt not working
PostPosted: Sat Dec 20, 2014 2:13 am     Reply with quote

Hi guys, I thought maybe somebody has run into this issue before. I'm using the PIC24FJ128GA306 with CCS PCM v5.017.

All four uarts are configured to send and receive using interrupts. All of them work except for RDA4, which is interrupt uart 4 on data reception. Here are a couple of things I've tried.

Swapping the IO pins (re-mappable) to ones that are confirmed working on another uart.
Checking to ensure RX interrupt enable is set correctly in the assembly listing (enable_interrupts(INT_RDA4)).
Ensured the correct value is placed to interrupt on 1 byte.
Verified the code is NOT executed in the interrupt.
Verified there is no pre-existing data in the buffer at startup that may cause issues (long shot).


I'm left scratching my head on this one. Any thoughts are greatly appreciated.
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Sat Dec 20, 2014 4:59 am     Reply with quote

Have just had a quick look, and can add the following:

It does correctly put the vector in the IVT.
It does correctly set the priority.
It does correctly adjust the pin mapping.
A quick look then shows it is not enabling UART4.

Try:
Code:

#word U4MODE=getenv("SFR:U4MODE")
#bit UART4EN=U4MODE.15

    //then before enabling interrupts, add
    UART4EN=TRUE;


No guarantees, haven't made sure there is nothing else wrong, but this one 'stands out'.
Eugeneo



Joined: 30 Aug 2005
Posts: 155
Location: Calgary, AB

View user's profile Send private message

PostPosted: Sat Dec 20, 2014 7:02 pm     Reply with quote

Thanks for the response.

I've tried what you suggested with no luck. As you mentioned, nowhere in the listing is 0x02B0.15 or 0x02B1.7 set. The defaults value is 0 for ports 1,2 and 3, and they are working fine.

I'm not even sure what to try next.

Code:

#word U4MODE=getenv("SFR:U4MODE")
#bit UART4EN=U4MODE.15

    //then before enabling interrupts, add
    UART4EN=TRUE;
Eugeneo



Joined: 30 Aug 2005
Posts: 155
Location: Calgary, AB

View user's profile Send private message

PostPosted: Sun Dec 21, 2014 2:04 am     Reply with quote

Update:

I checked the pin mapping. It looks like CCS 5.016 does not produce the code for specifically uart4 receive pin re-mapping. My compiler is out of date. Is there is revision log that I can look at to see if this fix has been applied somewhere in the newer version?

Thanks for the help.


Below is the ASM code to make it work for RP10 or PIN_F4.

Code:


#PIN_SELECT U4TX = PIN_F5
#PIN_SELECT U4RX = PIN_F4
#use rs232(UART4, stream=SP4, baud=19200, PARITY=N, BITS=8, errors)
....

//  Messy but just checking to see if this works because it was not in the listing
#asm
MOV #0x3F0A,W0          // Map RP10 or PIN_F4 to uart 4 rx
MOV W0,0x06B6           // RPINR27 Uart4 CTS/RX reg
#endasm

ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Dec 22, 2014 9:28 am     Reply with quote

The list of changes for each release can be found here:
http://www.ccsinfo.com/devices.php?page=versioninfo
In my experience more bugs are fixed than listed here.
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Mon Dec 22, 2014 9:44 am     Reply with quote

Except they only ever list about 1/10th of what actually changes....

However can say I tried with 5.028, and this did correctly set the pin selection register, but it still didn't work in MPLAB.
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