|
|
View previous topic :: View next topic |
Author |
Message |
Jim Mcbride Guest
|
int_RDA hanging, hopelessly confused |
Posted: Mon Mar 24, 2003 9:30 am |
|
|
<font face="Courier New" size=-1>Greeting PICC Gurus,
I have a project where 2 F877s@20MHz (try and) bounce info back and forth using HUART, and one of them using SUART to talk to a pc (debugging). I am having a problem sorting out how to get int32 variables passed. I think my answer is the get_string() function. The problem is I can't test to see if it works or not because I hang at int_rda. I have played with my code and it works fine right up to the point when I enable int_rda, so I know that is the suspect area.
I am using rb0 for Soft tx. Possible ext int problem?
I am going to try using errors but that won't help getting the data. Perhaps I am overflowing?
Here is what I am trying to accomplish with these two pics:
PIC1: @20Hz(after PID motor control routine), use HUART to pass 2 int32 variables to PIC2. PIC1 also has an int for tmr0(20hz), change on portb and serial interrupt.
PIC2: Has all bank4 used for a 2 dimensional (x,y) bit array (set, clear, read, print array). Recieve 2 consecutive int32 variables via int_RDA. Make grid adjustments, make motor control decisions, send back 4 byte variables to PIC1. I may have to change this to 3 bytes in case PIC1 is in an int routine. It also uses SUART to a PC so I can see what is going on. SUART seems ok.
The main problem is that niether PIC will do its INT_RDA routine. PIC2 hangs. PIC1 does not, but I think it is possible that one of the other Interrupts is keeping it from hanging. I will try a tmr0 interrupt on PIC2 and see if thats the case.
I have read all I can find here, in the manual, sample programs ect..., the thing should work. I can't wait to see what I am doing wrong.
Any and all help is appreciated.
Jim
</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 13001 |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
Re: int_RDA hanging, hopelessly confused |
Posted: Mon Mar 24, 2003 10:35 am |
|
|
:=<font face="Courier New" size=-1>Greeting PICC Gurus,
:=I have a project where 2 F877s@20MHz (try and) bounce info back and forth using HUART, and one of them using SUART to talk to a pc (debugging). I am having a problem sorting out how to get int32 variables passed. I think my answer is the get_string() function. The problem is I can't test to see if it works or not because I hang at int_rda. I have played with my code and it works fine right up to the point when I enable int_rda, so I know that is the suspect area.
:=I am using rb0 for Soft tx. Possible ext int problem?
:=I am going to try using errors but that won't help getting the data. Perhaps I am overflowing?
:=Here is what I am trying to accomplish with these two pics:
:=
:=PIC1: @20Hz(after PID motor control routine), use HUART to pass 2 int32 variables to PIC2. PIC1 also has an int for tmr0(20hz), change on portb and serial interrupt.
:=
:=PIC2: Has all bank4 used for a 2 dimensional (x,y) bit array (set, clear, read, print array). Recieve 2 consecutive int32 variables via int_RDA. Make grid adjustments, make motor control decisions, send back 4 byte variables to PIC1. I may have to change this to 3 bytes in case PIC1 is in an int routine. It also uses SUART to a PC so I can see what is going on. SUART seems ok.
:=
:=The main problem is that niether PIC will do its INT_RDA routine. PIC2 hangs. PIC1 does not, but I think it is possible that one of the other Interrupts is keeping it from hanging. I will try a tmr0 interrupt on PIC2 and see if thats the case.
:=
:=I have read all I can find here, in the manual, sample programs ect..., the thing should work. I can't wait to see what I am doing wrong.
:=Any and all help is appreciated.
:=Jim
:=</font>
Send and recieve bytes from interupt routines.
Increment a send or recieve index after each byte.
I assume your using packets to transfer your data.
<a href="http://www.pic-c.com/forum/general/posts/12642.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/12642.html</a>
Packets should be built and verified outside of interupts.
___________________________
This message was ported from CCS's old forum
Original Post ID: 13010 |
|
|
Jim Mcbride Guest
|
Re: int_RDA hanging, hopelessly confused |
Posted: Mon Mar 24, 2003 11:37 am |
|
|
:=:=<font face="Courier New" size=-1>Greeting PICC Gurus,
:=:=I have a project where 2 F877s@20MHz (try and) bounce info back and forth using HUART, and one of them using SUART to talk to a pc (debugging). I am having a problem sorting out how to get int32 variables passed. I think my answer is the get_string() function. The problem is I can't test to see if it works or not because I hang at int_rda. I have played with my code and it works fine right up to the point when I enable int_rda, so I know that is the suspect area.
:=:=I am using rb0 for Soft tx. Possible ext int problem?
:=:=I am going to try using errors but that won't help getting the data. Perhaps I am overflowing?
:=:=Here is what I am trying to accomplish with these two pics:
:=:=
:=:=PIC1: @20Hz(after PID motor control routine), use HUART to pass 2 int32 variables to PIC2. PIC1 also has an int for tmr0(20hz), change on portb and serial interrupt.
:=:=
:=:=PIC2: Has all bank4 used for a 2 dimensional (x,y) bit array (set, clear, read, print array). Recieve 2 consecutive int32 variables via int_RDA. Make grid adjustments, make motor control decisions, send back 4 byte variables to PIC1. I may have to change this to 3 bytes in case PIC1 is in an int routine. It also uses SUART to a PC so I can see what is going on. SUART seems ok.
:=:=
:=:=The main problem is that niether PIC will do its INT_RDA routine. PIC2 hangs. PIC1 does not, but I think it is possible that one of the other Interrupts is keeping it from hanging. I will try a tmr0 interrupt on PIC2 and see if thats the case.
:=:=
:=:=I have read all I can find here, in the manual, sample programs ect..., the thing should work. I can't wait to see what I am doing wrong.
:=:=Any and all help is appreciated.
:=:=Jim
:=:=</font>
:=
:=
:=Send and recieve bytes from interupt routines.
:=Increment a send or recieve index after each byte.
:=I assume your using packets to transfer your data.
:= <a href="http://www.pic-c.com/forum/general/posts/12642.html" TARGET="_blank"> <a href="http://www.pic-c.com/forum/general/posts/12642.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/12642.html</a></a>
:=Packets should be built and verified outside of interupts.
I had not thought of using packets. Good idea. But the problem still exists that I can't even send a single byte from one pic to the other with the serial receiving interrupt. It acts like it is going to the interrupt, but any testing within the interrupt (toggle led) does not happen.
___________________________
This message was ported from CCS's old forum
Original Post ID: 13011 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: int_RDA hanging, hopelessly confused |
Posted: Mon Mar 24, 2003 1:52 pm |
|
|
:=I have a project where 2 F877s@20MHz (try and) bounce info back and forth using HUART, and one of them using SUART to talk to a pc (debugging).
---------------------------------------------------------
So, HUART = Hardware UART, SUART = Software UART.
If INT_RDA locks up, then it means you are probably getting
a overrun error. You can determine if this is true, by
using the ERRORS parameter in your #use RS232 statement:
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
If that stops the lock-ups, then it was caused by overrun
errors. The question is, why ? In the INT_RDA routine, you
should have a getc() statement which reads the UART.
Then after reading the char, the code should put the char
into a software fifo. That's the only thing the INT_RDA
routine should do. Don't put any printf's or any other
time-consuming code in that routine. Anything that requires
a lot of time to do, should be put into the "foreground" code,
in main(). This way, your isr will be very responsive, and
it won't miss incoming bytes.
See the CCS example file, EX_SISR.C, for an example of how
to do a software receive fifo.
See the Microchip USART reference manual for information
on overrun errors.
<a href="http://www.microchip.com/1000/suppdoc/refernce/midrange/index.htm" TARGET="_blank">http://www.microchip.com/1000/suppdoc/refernce/midrange/index.htm</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 13018 |
|
|
Jim Mcbride Guest
|
Re: int_RDA hanging, hopelessly confused |
Posted: Tue Mar 25, 2003 8:29 am |
|
|
:=:=I have a project where 2 F877s@20MHz (try and) bounce info back and forth using HUART, and one of them using SUART to talk to a pc (debugging).
:=---------------------------------------------------------
:=
:=So, HUART = Hardware UART, SUART = Software UART.
:=
:=If INT_RDA locks up, then it means you are probably getting
:=a overrun error. You can determine if this is true, by
:=using the ERRORS parameter in your #use RS232 statement:
:=
:=#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
:=
:=If that stops the lock-ups, then it was caused by overrun
:=errors. The question is, why ? In the INT_RDA routine, you
:=should have a getc() statement which reads the UART.
:=Then after reading the char, the code should put the char
:=into a software fifo. That's the only thing the INT_RDA
:=routine should do. Don't put any printf's or any other
:=time-consuming code in that routine. Anything that requires
:=a lot of time to do, should be put into the "foreground" code,
:=in main(). This way, your isr will be very responsive, and
:=it won't miss incoming bytes.
:=
:=See the CCS example file, EX_SISR.C, for an example of how
:=to do a software receive fifo.
:=
:=See the Microchip USART reference manual for information
:=on overrun errors.
Well, I put in the errors parameter for both of my rs232 streams. Still hangs. I will have to go back to the basics and write up two skeleton programs to accomplish some baby steps.
If I use the fprintf() function to send and the get_string() function to recieve, so I need to send a CR at the end of fprintf() function so get_string nows that is the end of the string?
(any sample code out there?)
Jim
___________________________
This message was ported from CCS's old forum
Original Post ID: 13044 |
|
|
Jim Mcbride Guest
|
Re: int_RDA hanging, hopelessly confused |
Posted: Tue Mar 25, 2003 9:01 am |
|
|
<font face="Courier New" size=-1>:=:=:=I have a project where 2 F877s@20MHz (try and) bounce info back and forth using HUART, and one of them using SUART to talk to a pc (debugging).
:=:=---------------------------------------------------------
:=:=
:=:=So, HUART = Hardware UART, SUART = Software UART.
:=:=
:=:=If INT_RDA locks up, then it means you are probably getting
:=:=a overrun error. You can determine if this is true, by
:=:=using the ERRORS parameter in your #use RS232 statement:
:=:=
:=:=#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
:=:=
:=:=If that stops the lock-ups, then it was caused by overrun
:=:=errors. The question is, why ? In the INT_RDA routine, you
:=:=should have a getc() statement which reads the UART.
:=:=Then after reading the char, the code should put the char
:=:=into a software fifo. That's the only thing the INT_RDA
:=:=routine should do. Don't put any printf's or any other
:=:=time-consuming code in that routine. Anything that requires
:=:=a lot of time to do, should be put into the "foreground" code,
:=:=in main(). This way, your isr will be very responsive, and
:=:=it won't miss incoming bytes.
:=:=
:=:=See the CCS example file, EX_SISR.C, for an example of how
:=:=to do a software receive fifo.
:=:=
:=:=See the Microchip USART reference manual for information
:=:=on overrun errors.
:=Well, I put in the errors parameter for both of my rs232 streams. Still hangs. I will have to go back to the basics and write up two skeleton programs to accomplish some baby steps.
:=If I use the fprintf() function to send and the get_string() function to recieve, so I need to send a CR at the end of fprintf() function so get_string nows that is the end of the string?
:=(any sample code out there?)
:=Jim
I had a thought, Should I set up my int_RDA() to get only character at a time only? I was assuming I would get the interrupt to recieve data and I would sit there till all of the data stream was recieved. Shouldn't the interrupt occure, and so long as I have a waiting fgetc(), wait right there for a character?</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 13048 |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
Re: int_RDA hanging, hopelessly confused |
Posted: Tue Mar 25, 2003 9:45 am |
|
|
:=<font face="Courier New" size=-1>:=:=:=I have a project where 2 F877s@20MHz (try and) bounce info back and forth using HUART, and one of them using SUART to talk to a pc (debugging).
:=:=:=---------------------------------------------------------
:=:=:=
:=:=:=So, HUART = Hardware UART, SUART = Software UART.
:=:=:=
:=:=:=If INT_RDA locks up, then it means you are probably getting
:=:=:=a overrun error. You can determine if this is true, by
:=:=:=using the ERRORS parameter in your #use RS232 statement:
:=:=:=
:=:=:=#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
:=:=:=
:=:=:=If that stops the lock-ups, then it was caused by overrun
:=:=:=errors. The question is, why ? In the INT_RDA routine, you
:=:=:=should have a getc() statement which reads the UART.
:=:=:=Then after reading the char, the code should put the char
:=:=:=into a software fifo. That's the only thing the INT_RDA
:=:=:=routine should do. Don't put any printf's or any other
:=:=:=time-consuming code in that routine. Anything that requires
:=:=:=a lot of time to do, should be put into the "foreground" code,
:=:=:=in main(). This way, your isr will be very responsive, and
:=:=:=it won't miss incoming bytes.
:=:=:=
:=:=:=See the CCS example file, EX_SISR.C, for an example of how
:=:=:=to do a software receive fifo.
:=:=:=
:=:=:=See the Microchip USART reference manual for information
:=:=:=on overrun errors.
:=:=Well, I put in the errors parameter for both of my rs232 streams. Still hangs. I will have to go back to the basics and write up two skeleton programs to accomplish some baby steps.
:=:=If I use the fprintf() function to send and the get_string() function to recieve, so I need to send a CR at the end of fprintf() function so get_string nows that is the end of the string?
:=:=(any sample code out there?)
:=:=Jim
:=
:=I had a thought, Should I set up my int_RDA() to get only character at a time only? I was assuming I would get the interrupt to recieve data and I would sit there till all of the data stream was recieved. Shouldn't the interrupt occure, and so long as I have a waiting fgetc(), wait right there for a character?</font>
You should only recieve a single byte at a time. @20MHz crystle and 9600 Baud you have about 5,000 instructions you can perform between recieve interupts.
Try jumping to the interupt recieving the byte and throw it away, toggle the LED and return. This should lead you in the right direction.
___________________________
This message was ported from CCS's old forum
Original Post ID: 13050 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: int_RDA hanging, hopelessly confused |
Posted: Tue Mar 25, 2003 1:44 pm |
|
|
<font face="Courier New" size=-1>
<b> In the INT_RDA routine, you
should have a getc() statement which reads the UART.
Then after reading the char, the code should put the char
into a software fifo. That's the only thing the INT_RDA
routine should do. </b>
</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 13059 |
|
|
Darren Logan Guest
|
Re: int_RDA hanging, hopelessly confused |
Posted: Wed Mar 26, 2003 12:47 pm |
|
|
Hello,
I think you need to post some code!
Namely your Use_rs232 lines, your Int_rda and anything else related to the RS232 setup.
The famous question: "Are you using the appropriate RS232 driver chips?"
___________________________
This message was ported from CCS's old forum
Original Post ID: 13100 |
|
|
|
|
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
|