In PTU Module i need more PTUTriggerEventList

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

In PTU Module i need more PTUTriggerEventList

878 Views
leesang-bong
Contributor I


Hi i have Question about PTUTriggerEventList

now i used only one PTUTriggerEventList (volatile short PTUTriggerEventList[3]@0x02600 = {{0x0520,0x0600,0x0000}};)

but i need more PTUTriggerEventList because i use 1-shunt method. so 3-phase pwm are need flexible PTU timing so

i want know optional method. how can i do.

Labels (1)
Tags (1)
3 Replies

576 Views
leesang-bong
Contributor I

Hello

Thanks for your help, but i need more information, can you read my code?

i have to control PMSM by 1-shunt, sensorless. so i need two point of dc current measurement.

so in ptutriggerlist volatile short PTUTriggerEventList[2][2]@0x02600={0x0520,0x0600,0x0000};

but i need change address {0x520,0x0600,0x0000}  -> {delay1, delay2, 0x0000} because pmsm change pmfvalue every peroid.

delay1 = (dutycycle1+PMFTBA_DEADTIME+150)>>2;

delay2 = (dutycycle1+PMFTBA_DEADTIME+300)>>2;

PTUTriggerEventList[0][0] = PMFVAL0;

PTUTriggerEventList[0][1] = PMFVAL2;

so i made code, but when operate this code, RSTAR_EIF eroor is occurred. i can't solve this problem. can you help one more?

Thanks. and this code is not complete, but i want test delay1, delay2 operate in ptutriggerlist

/*

* PTU.c

*

*  Created on: Jan 13, 2016

*      Author: sang-bong

*/

#include "Define_Header.h"

#include "Define_PTU.h"

Uint16 sample_time1 = 0x0520;

Uint16 sample_time2 = 0x0610;

Uint16 delay1 = 0;

Uint16 delay2 = 0;

Uint16 dutycycle1 = 0;

Uint16 dutycycle2 = 0;

volatile short PTUTriggerEventList[2][2]@0x02600;

void Init_PTU(void)

{

_PTUIEL.Bits.TG0DIE = 1; // Enable Trigger Generator 0 Done Interrupt

dutycycle1 = PMFVAL0;

dutycycle2 = PMFVAL2;

delay1 = (dutycycle1+PMFTBA_DEADTIME+150)>>2;

delay2 = (dutycycle1+PMFTBA_DEADTIME+300)>>2;

PTUTriggerEventList[0][0] = PMFVAL0;

PTUTriggerEventList[0][1] = PMFVAL2;

//PTUTriggerEventList[0][2] = 0x0000;

PTUPTR = PTUTriggerEventList;   // Map start address & offset for 2nd (currently not used) list

TG0L1IDX = 0;  // Same as TG0L0IDX

PTUE_TG0EN = 1; // Enable Trigger Generator 0

PTUDEBUG_PTUT0PE = 1; // Enable Trigger 0 on PS0 pin

//PTUDEBUG_PTUREPE = 1; // Trigger generator on PS1 pin

PTUC_PTULDOK = 1;

}

interrupt VectorNumber_Vptutg0dn void PTUTrigger0Done_ISR(void)

{

//LED2_ON;  // debug pin ON //

PTUIFL = (1 << 0); // Clear flag

//LED2_OFF; // debug pin OFF //

}

interrupt void ADC0error_ISR(void)

{

ADC0CTL_0_ADC_SR = 1;

}

0 Kudos

576 Views
iggi
NXP Employee
NXP Employee

The problems always start when user modifies the SW which initial version worked fine.

The PTUTriggerEventList is not defined well. You set two columns and two rows, but defined the values for one row only which has 3 values. Incorrect. Correct would be for example:

PTUTriggerEventList[2][2] = {

     {a, b},

     {c, d}

}

Next thing, avoid using '@0x02600' to define exact memory location where to store values. The CW IDE has overlap warnings switched off, and you won't be warned if the values are overlapped.

Regarding the RSTAR_EIF error, as per S12ZVM RM, this is related to ADC module.That flag indicates a flow control issue and in your case it most probably happens when Restart Request occurs before the “End Of List” command type has been executed. This flag can cause error interrupt if enabled, but the ADC continues operation.

See S12ZVM ref.manual and chapter 9.6.3.2.6 Conversion flow control in case of conversion sequence control bit overrun scenarios for detailed description of Restart Request Overrun.

Regards,

iggi

0 Kudos

576 Views
iggi
NXP Employee
NXP Employee

Hello,

You can check how two PTU trigger lists are implemented in MTRCKTSPNZVM128 Software (REV 1.1) and hopefully that will give you a hint.

Find and open the ptu.c file in the installation directory on C drive of you PC:

MC9S12ZVML128_PMSM_Sensorless_SingleShunt\src\S12ZVM_system\peripherals

Or just open entire project in CodeWarrior v10.6 and look for ptu.c source file.

Regards,

iggi