Compilation error using 2 Interrupt driven blocks

Post Reply
MHuy
Posts: 6
Joined: Sat Oct 04, 2008 12:28 am

Compilation error using 2 Interrupt driven blocks

Post by MHuy » Wed Feb 18, 2009 2:37 am

Hi Lubin,

I try to send some information by SPI with two “Interrupt driven” blocks (which work on the same spi).
The problem is that these blocks can't have different numbers of trame (otherwise it will cause a compilation error).

In the example, the instantiation looks like :
extern unsigned volatile int SPI1Buffer_Receive[2];
extern unsigned volatile int SPI1Buffer_Send[2];
extern unsigned volatile int SPI1InterruptIdx;
extern unsigned volatile int SPI1Buffer_Receive[1];
extern unsigned volatile int SPI1Buffer_Send[1];
…and there is thus an error in the compilation.

A solution would be to have all blocks with the same number of trame.
However, it will send “0U” for each unconnected signal and there will be a lost of performance.

Is there another solution?

Michael
Attachments
test_2_SPI.mdl
(28.29 KiB) Downloaded 522 times

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Bayonne- France
Contact:

Re: Compilation error using 2 Interrupt driven blocks

Post by LubinKerhuel » Mon Mar 23, 2009 10:56 pm

Hi Michael,

As far as I remember, It is not possible to place two interrupt driven SPI block. Even it compilation is Ok, the behaviour will not be Ok. You will not get the requested results.

It is difficult to imagine a solution with a possibility to have two SPI driven block. It may be possible on one SPI driven block to add an entry for each input to activate or inactivate this entry during the next time step. However, that would add complexity for using the block, and I am not sure of the benefits that it would provide.

You may try using non driven SPI blocks. The other solution would be to use the custom C function call and to add your own interrupt code.

If it is a show stopper, could you explain what is it for. It would help to think about one solution...

Lubin

MHuy
Posts: 6
Joined: Sat Oct 04, 2008 12:28 am

Re: Compilation error using 2 Interrupt driven blocks

Post by MHuy » Mon Apr 06, 2009 10:55 am

I m now using the non driven SPI block and it works perfectly.

Thanks for your help!

Michael

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests