Model Base rate issue in multiple atomic block system
Mostra commenti meno recenti
I have set up a nested interrupt control architecture on an embedded MCU, and i am using simulink Ebmbedded Code Generator to compile executable functions. One subsystem runs at 100kHz and the other at 20kHz. The issue i'm facing is that the 20kHz model, even though it's a separate subsystem with its own atomic sample time, has a rate scheduler function that's indexing the 100kHz rate. The trouble is that the ISR in the MCU is already at 20kHz, this makes it run at 4kHz (20 divided by 5).
I don't now how to set its as its own independednt sample time within the simulink model.
/*
* This function updates active task flag for each subrate.
* The function is called at model base rate, hence the
* generated code self-manages all its subrates.
*/
static void rate_scheduler(void)
{
/* Compute which subrates run during the next base time step. Subrates
* are an integer multiple of the base rate counter. Therefore, the subtask
* counter is reset when it reaches its limit (zero means run).
*/
(M_Slow->Timing.TaskCounters.TID[1])++;
if ((M_Slow->Timing.TaskCounters.TID[1]) > 4) {/* Sample time: [5.0E-5s, 0.0s] */
M_Slow->Timing.TaskCounters.TID[1] = 0;
}
}
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Deployment, Integration, and Supported Hardware in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!