|
|
View previous topic :: View next topic |
Author |
Message |
blups
Joined: 05 May 2011 Posts: 10
|
CCS C 5.046 PIC24FJ128GB106 RDA problem |
Posted: Wed May 27, 2015 3:14 am |
|
|
Hi peeps,
I have some difficulties using the the last(5.046) CCS C compiler with handling the rda interrupt. The IDE is also ver. 5.046.
The chip is 24FJ128GB106 and stacks by the receiving of the character.
Using the CCS C ver.4.112 compiler there is no problem!
The UART's config:
Code: | #pin_select U1TX=PIN_D11
#pin_select U1RX=PIN_D0
#use rs232(UART1, baud=57600, stream=UART_PORT1) // PC
#pin_select U2TX=PIN_B9
#pin_select U2RX=PIN_B8
#use rs232(UART2, baud=57600, stream=UART_PORT2) // Module
#pin_select U3TX=PIN_G7
#pin_select U3RX=PIN_G6
#use rs232(UART3, baud=57600, stream=UART_PORT3) // Reserved |
The source:
Code: |
#int_RDA
void RDA_isr(void)
{
ch=getch(); // [color=red]There is the stack!!![/color]
if((ch==0xa9)&&(!ReceiveModule_En))
{
ReceiveModule_En=1;
RS_TimeProtect_fl=1;
ByteCnt=0;
chBufferUART2[0]=ch;
}else if(ReceiveModule_En)
{
ByteCnt++;
chBufferUART2[ByteCnt]=ch;
.
.
.
}
|
Any ideas?
Much 10x in advance
GR |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Wed May 27, 2015 3:23 am |
|
|
ch=fgetc(UART_PORT1);
getc, gets the character from the _last UART defined_, unless you use a stream name. So your INT_RDA (saying you have a character waiting on UART1), is then trying to read from UART3......
If you have multiple UARTs enabled, and in use, then _every_ function that uses them, must specify the stream to be used. |
|
|
blups
Joined: 05 May 2011 Posts: 10
|
|
Posted: Wed Jun 03, 2015 12:24 am |
|
|
Hi Ttelmah,
I tried a simple project created with the wizard, following your advise(using all the fXXXXX functions(fputc, fgetc, fprintf with calling the actual stream)) and it still doesn't work! Using this functions I succeded to drive the int only from PORT_UART1 :(
It seems to be a big disaccord and I continue to use my old ver. 4.112. Anyway my company gived the money for the latest one... :( ..... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Wed Jun 03, 2015 1:47 am |
|
|
OK.
A few versions ago, I found on a close relative chip, that the interrupt numbers were swapped. So it called the routine for RDA2, when it was actually the port corresponding to RDA3 that had interrupted...
However that was fixed on the next compiler version on that chip.
I ran it under an ICD, so was able stop at the interrupt and check what interrupt had actually fired, and what UART had data. I wonder if something similar has happened on .046 and your chip....
I must admit I'm still sticking at .045, haven't bothered to update this at the moment.
I keep versions when I update (currently probably have 30 versions available to use), and only update when, either a new chip feature is needed, or a problem needs fixing. I turn off the automatic updating. Caused too many problems for me. Code always includes as part of the comments at the top, what compiler version I used for it.
So 'nasty suspicion' runs that possibly .046 is doing something naughty here....
However ensuring your code genuinely does read the correct UART for the interrupt required, is the right way to go 'long term'. |
|
|
|
|
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
|