External interrupt with the Model Based Design Toolbox

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

External interrupt with the Model Based Design Toolbox

1,150 Views
markusransberge
Contributor III

Hello,

I'm missing a feature in the MBDToolbox which I am using with the DEVKIT-MPC5744P. Since the board has no easy accessible pins (without soldering) to trigger the CTU0 to start an ADC conversion, I would need another way to get an external interrupt request via available IO pins. The standard way, using S32 IDE does work fine (still without using the CTUs), but in Simulink I'm missing the possibility to place a trigger block with external interrupt capabilities.

I found the "mbdtargetmainlibpnt.tlc" file where the interrupt handlers are defined, but vectors like "Vector # 243 SIUL2 External Interrupt_0" and so on are not being used.

The main goal is to use the toolbox to create runnable code for that board but there aren't enough functions blocks for specific things like interrupts (and their glitch filter, et cetera).

So what are my options here?

(I'm thinking about adding the missing interrupt handlers to that .tlc file and then adding a S function block with the rest of the code. I'm not sure if that will work, though.)

Thank you,

Markus R.

PS: Could you please think about not using the CTU0 EXT_IN pins for LEDs and a chip enable in the next revision of the board? That would be great because I would like to use that feature someday.

0 Kudos
4 Replies

913 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi markusransberger‌,

Have you looked at the adc_ctu_dma_model.mdl example? I think is the quite closed to what you plan to do.


Regarding the option exposure - you are correct - the current version does not expose all the combinations supported by the HW. Such functionalities are on our radar and we'll try to add it for future versions.

Regarding the extension of the toolbox, please give it a try. It should work with customer S-function code injection. In case you face any bottlenecks, please let us know and we will try to help you with the m-source file whenever is necessary.

Best regards,

Daniel

0 Kudos

913 Views
markusransberge
Contributor III

Hi again,

thanks for your answer. I actually looked at the adc_ctu_dma_model example before, but that DMA interrupt is obviously not generated by an external source.

Right now I'm trying to use the eTimer block to generate a usable interrupt which isn't functioning right now, but I'll try some more. I already got it to work when I programmed it in S32 IDE, though. (The delay time (when changing one pin state) for that interrupt was around 850ns which is sufficient for my task.) Hopefully the eTimer can then be used like in that DMA interrupt example to trigger the CTU. At least there are options for that.

Another thing I tried: Injecting code via the S-function block. Sadly this didn't work and I'm guessing that my files are not being copied over to the right place after I generated the Wrapper and the rest of the files. Also I cannot check the "mbd_pnt_user_copy_required_files.p" (to be found in ...\mbdtbx_pnt\mbdtbx_pnt\mscripts\utils) since that's a compiled Matlab script file afaik.

Thanks again and have a nice day,

Markus R.

0 Kudos

913 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi markusransberger‌,

Please find attached the m-file version of the mbd_pnt_user_copy_required_files 

Just copy-paste it into the ..mbdtbx_MPC574xP\mbdtbx_pnt\mbdtbx_pnt\mscripts\utils\ folder. Now you should be able to use the S-function.

Can you provide more insights about what would you like to achieve with this interrupt ? Perhaps we can find others way to do it.

Best regards,

Daniel

913 Views
markusransberge
Contributor III

Hello again,

thanks again for the fast response. My first little test project should do the following:

The external interrupt should trigger a chain of ADC readings on several channels (triggering via CTU is preferred, DMA is optional right now) and evaluate them. My idea now, since the CTU external input pins are not easily available, is to use an eTimer interrupt to trigger the CTU which is then doing some ADC readings.

So right now I'm testing the capabilities of the toolbox.

The code insertion via S-function works for me now after I converted your provided .m script into a .p file via Matlab's pcode('xyz') function. Just placing it into the folder is NOT sufficient. I just got it to compile some minutes ago, so I don't have any further tests so far.

Kind regards,

Markus R.

0 Kudos