|
dear all, To implement interrupt in ADSP using C, I can use interrupt() function. It needs to include signal.h file. But I don't see any handler for CAN interrupt. If anyone has done it before, please let me know. regards, Hany Ferdinando MSc Student on Embedded Control System University of Twente The Netherlands |
|
|
implementing CAN interrupt
Started by ●April 4, 2003
Reply by ●April 4, 20032003-04-04
|
On Fri, 4 Apr 2003, Hany Ferdinando wrote: > To implement interrupt in ADSP using C, I can use interrupt() function. It > needs to include signal.h file. But I don't see any handler for CAN interrupt. > If anyone has done it before, please let me know. Which processor? None of thw ADI processors I use have a direct CAN interface, so there's no interrupt to deal with it. Easy enough to write one given the specs though. Patience, persistence, truth, Dr. mike |
Reply by ●April 4, 20032003-04-04
|
I am sorry not to give detail information. I used ADSP-21992 EZ-KIT
LITE. It is equipped with CAN controller. -------Original Message------- From: Mike Rosing Date: Friday, April 04, 2003 6:39:04 PM To: Hany Ferdinando Cc: Subject: Re: [adsp] implementing CAN interrupt On Fri, 4 Apr 2003, Hany Ferdinando wrote: > To implement interrupt in ADSP using C, I can use interrupt() function. It > needs to include signal.h file. But I don't see any handler for CAN interrupt. > If anyone has done it before, please let me know. Which processor? None of thw ADI processors I use have a direct CAN interface, so there's no interrupt to deal with it. Easy enough to write one given the specs though. Patience, persistence, truth, Dr. mike _____________________________________ Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer. You need to do a "reply all" if you want your answer to be distributed to the entire group. _____________________________________ About this discussion group: To Join: Send an email to To Post: Send an email to To Leave: Send an email to Archives: http://groups.yahoo.com/group/adsp Other Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/ . | |||
| |||
|
|
Reply by ●April 4, 20032003-04-04
|
On Fri, 4 Apr 2003, Hany Ferdinando wrote: > I am sorry not to give detail information. I used ADSP-21992 EZ-KIT LITE. > It is equipped with CAN controller. I looked at the datasheet, I can see why you are confused. There must be a way to set up one of the "user interrupts" as dedicated to the CAN controller. I don't see anything in the datasheet that tells how to do that, so I suspect the usermanual is the thing thing to get ahold of. I suspect once you figure it out it won't be that hard. Set a routine to deal with CAN interrupts, then put the address of that routine in one of the "user assigned interrupt" locations, and flip some bits in the periferal interrupt controller and it'll work. Good luck! Patience, persistence, truth, Dr. mike |
Reply by ●April 5, 20032003-04-05
|
dear Mike, You wrote that I have to set an interrupt service routine for CAN in spesific address. How to do it in VisualDSP++? And how to program ADSP to react for CAN interrupt. Because for successful sending and receiving message, there will be an interrupt. How my ADSP detect this interrupt? regards, Hany -------Original Message------- From: Mike Rosing Date: Friday, April 04, 2003 9:06:38 PM To: Hany Ferdinando Cc: Subject: Re: [adsp] implementing CAN interrupt On Fri, 4 Apr 2003, Hany Ferdinando wrote: > I am sorry not to give detail information. I used ADSP-21992 EZ-KIT LITE. > It is equipped with CAN controller. I looked at the datasheet, I can see why you are confused. There must be a way to set up one of the "user interrupts" as dedicated to the CAN controller. I don't see anything in the datasheet that tells how to do that, so I suspect the usermanual is the thing thing to get ahold of. I suspect once you figure it out it won't be that hard. Set a routine to deal with CAN interrupts, then put the address of that routine in one of the "user assigned interrupt" locations, and flip some bits in the periferal interrupt controller and it'll work. Good luck! Patience, persistence, truth, Dr. mike _____________________________________ Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer. You need to do a "reply all" if you want your answer to be distributed to the entire group. _____________________________________ About this discussion group: To Join: Send an email to To Post: Send an email to To Leave: Send an email to Archives: http://groups.yahoo.com/group/adsp Other Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/ . | |||
| |||
|
|
Reply by ●April 5, 20032003-04-05
|
On Sat, 5 Apr 2003, Hany Ferdinando wrote: > You wrote that I have to set an interrupt service routine for CAN in > spesific address. How to do it in VisualDSP++? And how to program ADSP to > react for CAN interrupt. Because for successful sending and receiving > message, there will be an interrupt. How my ADSP detect this interrupt? I'm not really sure. I think you can specify the linker description file so it points a block of code to a specific address block. Then you make sure your code has the same segment name specified in the .ldf. However, I don't have the manual for that particular processor, so I don't know the details. If you don't have the manual, then my bet is you can find it somewhere on the ADI web site. Download the whole thing (will probably take a while!) and read the relevent sections on CAN, interrupts and setting up the .ldf. Connecting the CAN to the correct vector interrupt must be done in some kind of register on the CAN periferal, or in a special location on the chip. You need to figure that out, and then set up the C code to do that task. It might be you must write a small chunk of initialization code which writes a pointer value into a special register that tells the interrupt controller what to do with the CAN interrupt, then you can place the address of your interrupt service routine in the interrupt vector block. NOTE: this is a *guess*. I don't know how it really works. But the datasheet gives a clue that you have some flexability (which is nice), but that makes things more complicated (so you have to work a bit harder to figure it out the first time!) If the manuals don't tellyou enough, start asking some questions of your local ADI field applications engineer (FAE). I'm sure they'll be happy to help. Patience, persistence, truth, Dr. mike |
|
|
Reply by ●April 7, 20032003-04-07
|
--On Saturday, April 05, 2003 9:32 PM +0200 Hany Ferdinando <> wrote: > You wrote that I have to set an interrupt service routine for CAN in > spesific address. How to do it in VisualDSP++? Start with the C library manual, paying attention to the interrupt() API. Then look at the header that defines this API (signal.h for SHARC and Blackfin), and look at the library sources to see what the API's really do under the hood. There's no shortcuts. You have to work through the material. Try to get your FAE to send you some sample code, though. Also check the chip errata sheet, as there are sometimes chip bugs involving the interrupt system. |
|
|
Reply by ●April 8, 20032003-04-08
|
Hi Kenneth, Thanks for your suggestion. I have found interrupt() API. The first argument is SIG_xxxxx signal and the second argument is interrupt service routine. I can set the priority of this interrupt using IPRx. I want to map CAN interrupt to USR0. I knew that USR0 is detected by SIG_INT4. But how to map CAN interrupt to USR0? To tell ADSP to jump to CAN_ISR is simple. I can use interrupt(SIG_INT4,CAN_ISR), but how to map my interrupt to USR0? regards, Hany Quoting Kenneth Porter <>: > Start with the C library manual, paying attention to the interrupt() API. > Then > look at the header that defines this API (signal.h for SHARC and Blackfin), > and look at the library sources to see what the API's really do under the > hood. > > There's no shortcuts. You have to work through the material. Try to get your > FAE to send you some sample code, though. Also check the chip errata sheet, > as > there are sometimes chip bugs involving the interrupt system. |
Reply by ●April 10, 20032003-04-10
|
hello Mike, My CAN interrupt is working now. But it detected only the first interrupt. I placed 2 breakpoints on the ISR for this. After the second breakpoint, I continued it, to wait for the next interrupt. But I didn't get it. Here is my simple ISR. Do you see mistakes in my ISR? void CAN_RX_IRQ() { sysreg_write(sysreg_IOPG,CAN_Page); // first breakpoint io_space_write(CANMC,0x0000); // disable mailbox MB02Data0 = io_space_read(CANMB02_DATA0); MB02Data1 = io_space_read(CANMB02_DATA1); MB02Data2 = io_space_read(CANMB02_DATA2); MB02Data3 = io_space_read(CANMB02_DATA3); io_space_write(CANMBRIF,0x000c); // clear interrupt io_space_write(CANRMP,0x000c); // clear pending bit io_space_write(CANMC,0x000e); // enable mailbox enable_interrupts(); // second breakpoint } regards, Hany Quoting Mike Rosing <>: > Connecting the CAN to the correct vector interrupt must be done in some > kind of register on the CAN periferal, or in a special location on the > chip. You need to figure that out, and then set up the C code to do that > task. It might be you must write a small chunk of initialization code > which writes a pointer value into a special register that tells the > interrupt controller what to do with the CAN interrupt, then you can place > the address of your interrupt service routine in the interrupt vector > block. |
|
|
Reply by ●April 10, 20032003-04-10
|
On Thu, 10 Apr 2003, Hany Ferdinando wrote: > My CAN interrupt is working now. But it detected only the first interrupt. I > placed 2 breakpoints on the ISR for this. After the second breakpoint, I > continued it, to wait for the next interrupt. But I didn't get it. > > Here is my simple ISR. Do you see mistakes in my ISR? > > void CAN_RX_IRQ() > { > sysreg_write(sysreg_IOPG,CAN_Page); // first breakpoint > > io_space_write(CANMC,0x0000); // disable mailbox > MB02Data0 = io_space_read(CANMB02_DATA0); > MB02Data1 = io_space_read(CANMB02_DATA1); > MB02Data2 = io_space_read(CANMB02_DATA2); > MB02Data3 = io_space_read(CANMB02_DATA3); > io_space_write(CANMBRIF,0x000c); // clear interrupt > io_space_write(CANRMP,0x000c); // clear pending bit > io_space_write(CANMC,0x000e); // enable mailbox > > enable_interrupts(); // second breakpoint > } I don't understand why you need to enable_interrupts inside the ISR. That should be done outside. usually the processor saves the interrupt enable status in the stack, so when it does the return from interrupt the stack is popped the enable/disable is set to the right value. I haven't a clue what the code does there since I'm not familiar with this particular processor. Do you need to include a special "return from interrupt" instruction or function so the compiler knows this is an isr? Or does the name of the routine tell it that? (I do most of my coding in assembler, so I know what is supposed to happen. With C, a lot of the basics are hidden because the compiler can do it for you.) Patience, persistence, truth, Dr. mike |






