AnsweredAssumed Answered

Using eTPU C-API-Functions

Question asked by Robert Metzeroth on May 10, 2019
Latest reply on May 14, 2019 by David Tosenovjan

Hello,

 

 i work with MPC5777C and S32-Studio. I want realize a Permanent Magnet Synchronous Motor Vector Control (AN3206, etpu set 4) .

 

The ADC works and is triggered from ASAC-module. DMA between ADC RFIFO and ASAC works not yet, but preliminary i read out the RFIFO interrupt triggered and store result values in result queue of the ASAC module.
Now i want read out the sample values of ASAC with the API-function "fs_etpu_asac_get_sampleX(…)". Phase A works and phase C, too. But if i want read out the phase b, an IVOR1-interrupt is generated. The SDMERR-Bit in eTPU->SCR->MCR-register is set. I looked at the corresponding memory address in SDM via Debugger. Some values which could be the sample values are stored there.  
Is it an access collision problem of SDM? In general, can i use this read out api functions free and independent of the etpu-internal timing? Or is it necessary to wait for a moment, where the etpu does not access this SDM address, and then call this host readout api-function?
But i do not know in detail, when ASAC write or read in sdm-memory.

 

A further case: for debugging, i want write voltage vector via the api-function "fs_etpu_pwmmac_update_svm(...)" in etpu function pwmmac. This works fine. But is it correct, to call this function on a random time, or do i have to synchronize this call to a time slot, where pwmmac is not active in  progress? It is clear that the best time is to call it before update time starts. But in general: are there effects to the etpu- function, when i call it randomly?

 

Last question:
I generate a voltage vector with alpha and beta components and write it to pwmmac with "fs_etpu_pwmmac_update_svm(...)" It is calculated with angle from  0 to 360 degrees with cos() and sin() and so on. Related to figure 2 of AN 2969 the sector number i get from "fs_etpu_pwmmac_get_sector()" should be  the sequence 1,2,3,4,5,6 in this constellation of rotating voltage vector. But real i get 3,1,5,4,6,2. Is there an update in etpu-function?

 

Thank you for help!
Robert.

Outcomes