Using eTPU C-API-Functions

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

Using eTPU C-API-Functions

1,055 Views
robert_metzerot
Contributor II

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.

3 Replies

902 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, I guess, it could be due to ECC in parameter RAM that has been added to MPC5676R and MPC5777C.

 

Try to add this code before eTPU initialization:

#define eTPU_AB_SPRAM_start      0xC3FC8000

#define eTPU_AB_SPRAM_end        0xC3FC97FF

 

/* Clear all ETPU SRAM memories due to ECC */

// eTPU A/B parametric RAM

for (i=eTPU_AB_SPRAM_start; i<eTPU_AB_SPRAM_end; i=i+4)

{

    (*(uint32_t *) i) = 0;

}

Let me know if it helps or not.

902 Views
robert_metzerot
Contributor II

Hello David,

thank you very much!

Yes the problem of issue 1 seems to be solved. But why do you define the end of eTPU_AB sram to 0xC3FC97FF? In the memory map the end is shown at 0xC3FCBFFF. What is the reason therefore?

The issue 3 i asked: i will test it with the changed source code as soon as possible. I give a reply till end of week, to close the case if so.

The question is of this sector sequence of pwmmac is correct so an the asac-module can use this value correct…

902 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Yes, you are right. Please use 0xC3FCBFFF as end address.

0 Kudos
Reply