S32K344 - EMIOS - IPM (Input Period Measurement) erroneous data acquisition

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

S32K344 - EMIOS - IPM (Input Period Measurement) erroneous data acquisition

Jump to solution
64 Views
fede_ls
Contributor II

Hi,

I'm writing a bare metal driver for the EMIOS module on my  S32K3X4EVB-T172 evaluation board.

 

Currently, I'm using EMIOS_0 configured, with a 256x global prescaler, with channels as follows:

CH_23 -> MC Up Counter ( Timebase for Emios Counter Bus A) @ 625 kHz 

CH_17 -> Running in OPWMB mode (using Counter Bus A)

CH_22 -> MC Up Counter ( Timebase for Emios Counter Bus F) @ 156.25 kHz

CH_9 -> Running in IPM mode (using Counter Bus F )

 

I'm generating a 16.18hz signal with 50% duty cycle, validated by the oscilloscope, that I'm routing from the OPWMB channel (PTA0) to the IPWMB channel (PTA1).

Every 10ms I'm acquiring a IPM sample, which consistently returns 9657/9658, giving me a measured period of 9657 * 0,0000064 = 0,0618048, resulting in a frequency of 1/0,0618048 = 16,18hz.

The Issue I'm having is related the almost periodical acquisition of erroneous values (as shown below).

period[0] UINT16 40017
period[1] UINT16 9658
period[2] UINT16 9657
period[3] UINT16 9658
period[4] UINT16 40017
period[5] UINT16 9658
period[6] UINT16 9657
period[7] UINT16 9658
period[8] UINT16 40017
period[9] UINT16 9658
period[10] UINT16 9657
period[11] UINT16 40018
period[12] UINT16 9657
period[13] UINT16 9658
period[14] UINT16 9657
period[15] UINT16 40018

 

Here's a code snippet explaining my current polling-based acquisition logic (no dma and no interrupts):

if ((EMIOS0->UC[9].S & 1u) != 0u)

{

UINT16 a1 = (UINT16)EMIOS0->UC[9].A;

UINT16 b1 = (UINT16)EMIOS0->UC[9].B;

UINT16 a2 = (UINT16)EMIOS0->UC[9].A;

UINT16 b2 = (UINT16)EMIOS0->UC[9].B;

if (a1 != a2)

{

if (b1 != b2)

{

period[ Index ] = (UINT16)(a2 - b2);

}

else

{

period[ Index ] = (UINT16)(a1 - b1);

}

}

else

{

period[ Index ] = (UINT16)(a2 - b2);

}

Index++;

if (Index > 99u)

Index = 0u;

EMIOS0->UC[9].S = EMIOS_UC_CLEAR_STATUS_FLG; /* 80008001u */

}

 

When testing different frequencies, the appearance of outliers is highly reduced but still present. Here's an example with 303hz:

period[0] UINT16 519
period[1] UINT16 519
period[2] UINT16 519
period[3] UINT16 519
period[4] UINT16 519
period[5] UINT16 519
period[6] UINT16 519
period[7] UINT16 519
period[8] UINT16 519
period[9] UINT16 519
period[10] UINT16 519
period[11] UINT16 519
period[12] UINT16 519
period[13] UINT16 30879
period[14] UINT16 519
period[15] UINT16 519
period[16] UINT16 519
period[17] UINT16 519
period[18] UINT16 519
period[19] UINT16 519
period[20] UINT16 519
period[21] UINT16 519
period[22] UINT16 519
period[23] UINT16 519
period[24] UINT16 519
period[25] UINT16 519
period[26] UINT16 519
period[27] UINT16 519
period[28] UINT16 519
period[29] UINT16 519
period[30] UINT16 519
period[31] UINT16 519
period[32] UINT16 519
period[33] UINT16 519
period[34] UINT16 519
period[35] UINT16 519
period[36] UINT16 519
period[37] UINT16 519
period[38] UINT16 519
period[39] UINT16 519
period[40] UINT16 519
period[41] UINT16 519
period[42] UINT16 519
period[43] UINT16 519
period[44] UINT16 519
period[45] UINT16 519
period[46] UINT16 519
period[47] UINT16 519
period[48] UINT16 519
period[49] UINT16 519
period[50] UINT16 519
period[51] UINT16 519
period[52] UINT16 519
period[53] UINT16 519
period[54] UINT16 519
period[55] UINT16 519
period[56] UINT16 519
period[57] UINT16 519
period[58] UINT16 30879
period[59] UINT16 519

 

Any help?

Tags (5)
0 Kudos
Reply
1 Solution
34 Views
PavelL
NXP Employee
NXP Employee

Hello @fede_ls ,

Your polling logic is probably not the primary source of the observed outliers. The values strongly suggest that the period calculation does not handle the rollover of the selected counter bus correctly. The current expression (uint16_t)(A - B) assumes a full 16-bit counter rollover at 65536, but your counter bus F appears to roll over at approximately 35176 ticks. Therefore, whenever the captured period crosses the counter rollover, an additional offset of 65536 - 35176 = 30360 ticks is added, which exactly matches the observed outliers.
 
Please check the period/modulus configured for CH22, which is used as counter bus F for the IPM channel. The period should be calculated using this actual counter bus modulo value, not using implicit 16-bit unsigned subtraction.
 

Best regards,

Pavel

View solution in original post

0 Kudos
Reply
1 Reply
35 Views
PavelL
NXP Employee
NXP Employee

Hello @fede_ls ,

Your polling logic is probably not the primary source of the observed outliers. The values strongly suggest that the period calculation does not handle the rollover of the selected counter bus correctly. The current expression (uint16_t)(A - B) assumes a full 16-bit counter rollover at 65536, but your counter bus F appears to roll over at approximately 35176 ticks. Therefore, whenever the captured period crosses the counter rollover, an additional offset of 65536 - 35176 = 30360 ticks is added, which exactly matches the observed outliers.
 
Please check the period/modulus configured for CH22, which is used as counter bus F for the IPM channel. The period should be calculated using this actual counter bus modulo value, not using implicit 16-bit unsigned subtraction.
 

Best regards,

Pavel

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2392112%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K344%20-%20EMIOS%20-%20IPM%20(Input%20Period%20Measurement)%20erroneous%20data%20acquisition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2392112%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI'm%20writing%20a%20bare%20metal%20driver%20for%20the%20EMIOS%20module%20on%20my%26nbsp%3B%26nbsp%3BS32K3X4EVB-T172%26nbsp%3Bevaluation%20board.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ECurrently%2C%20I'm%20using%20EMIOS_0%20configured%2C%20with%20a%20256x%20global%20prescaler%2C%20with%20channels%20as%20follows%3A%3C%2FP%3E%3CP%3ECH_23%20-%26gt%3B%20MC%20Up%20Counter%20(%20Timebase%20for%20Emios%20Counter%20Bus%20A)%26nbsp%3B%40%20625%20kHz%26nbsp%3B%3C%2FP%3E%3CP%3ECH_17%20-%26gt%3B%20Running%20in%20OPWMB%20mode%20(using%20Counter%20Bus%20A)%3C%2FP%3E%3CP%3ECH_22%20-%26gt%3B%20MC%20Up%20Counter%20(%20Timebase%20for%20Emios%20Counter%20Bus%20F)%26nbsp%3B%40%26nbsp%3B156.25%20kHz%3C%2FP%3E%3CP%3ECH_9%20-%26gt%3B%20Running%20in%20IPM%20mode%20(using%20Counter%20Bus%20F%20)%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI'm%20generating%20a%2016.18hz%20signal%20with%2050%25%20duty%20cycle%2C%20validated%20by%20the%20oscilloscope%2C%20that%20I'm%20routing%20from%20the%20OPWMB%20channel%20(%3CSPAN%3EPTA0)%20to%20the%20IPWMB%20channel%20(PTA1).%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EEvery%2010ms%20I'm%20acquiring%20a%20IPM%20sample%2C%20which%20consistently%20returns%26nbsp%3B9657%2F9658%2C%20giving%20me%20a%20measured%20period%20of%26nbsp%3B9657%20*%26nbsp%3B0%2C0000064%20%3D%26nbsp%3B0%2C0618048%2C%20resulting%20in%20a%20frequency%20of%201%2F0%2C0618048%20%3D%26nbsp%3B16%2C18hz.%3C%2FP%3E%3CP%3EThe%20Issue%20I'm%20having%20is%20related%20the%20%3CEM%3Ealmost%3C%2FEM%3E%20%3CSTRONG%3Eperiodical%20acquisition%20of%20erroneous%20values%3C%2FSTRONG%3E%20(as%20shown%20below).%3C%2FP%3E%3CDIV%3E%3CSPAN%3Eperiod%5B0%5D%20UINT16%20%3CSTRONG%3E40017%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B1%5D%20UINT16%209658%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B2%5D%20UINT16%209657%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B3%5D%20UINT16%209658%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B4%5D%20UINT16%20%3CSTRONG%3E40017%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B5%5D%20UINT16%209658%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B6%5D%20UINT16%209657%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B7%5D%20UINT16%209658%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B8%5D%20UINT16%20%3CSTRONG%3E40017%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B9%5D%20UINT16%209658%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B10%5D%20UINT16%209657%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B11%5D%20UINT16%20%3CSTRONG%3E40018%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B12%5D%20UINT16%209657%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B13%5D%20UINT16%209658%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B14%5D%20UINT16%209657%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eperiod%5B15%5D%20UINT16%20%3CSTRONG%3E40018%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CP%3EHere's%20a%20code%20snippet%20explaining%20my%20current%20polling-based%20acquisition%20logic%20(no%20dma%20and%20no%20interrupts)%3A%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CP%3E%3CSPAN%3Eif%3C%2FSPAN%3E%20%3CSPAN%3E((%3C%2FSPAN%3E%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3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3EIndex%3C%2FSPAN%3E%20%3CSPAN%3E%26gt%3B%3C%2FSPAN%3E%20%3CSPAN%3E99%3C%2FSPAN%3E%3CSPAN%3Eu%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIndex%3C%2FSPAN%3E%20%3CSPAN%3E%3D%3C%2FSPAN%3E%20%3CSPAN%3E0%3C%2FSPAN%3E%3CSPAN%3Eu%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EEMIOS0%3C%2FSPAN%3E%3CSPAN%3E-%26gt%3B%3C%2FSPAN%3E%3CSPAN%3EUC%3C%2FSPAN%3E%3CSPAN%3E%5B%3C%2FSPAN%3E%3CSPAN%3E9%3C%2FSPAN%3E%3CSPAN%3E%5D%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3ES%20%3C%2FSPAN%3E%3CSPAN%3E%3D%3C%2FSPAN%3E%3CSPAN%3E%20EMIOS_UC_CLEAR_STATUS_FLG%3C%2FSPAN%3E%3CSPAN%3E%3B%20%2F*%2080008001u%20*%2F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CP%3EWhen%20testing%20different%20frequencies%2C%20the%20appearance%20of%20outliers%20is%20highly%20reduced%20but%20still%20present.%20Here's%20an%20example%20with%20303hz%3A%3C%2FP%3E%3CP%3Eperiod%5B0%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B1%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B2%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B3%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B4%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B5%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B6%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B7%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B8%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B9%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B10%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B11%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B12%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B13%5D%20UINT16%20%3CSTRONG%3E30879%3C%2FSTRONG%3E%3CBR%20%2F%3Eperiod%5B14%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B15%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B16%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B17%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B18%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B19%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B20%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B21%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B22%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B23%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B24%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B25%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B26%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B27%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B28%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B29%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B30%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B31%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B32%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B33%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B34%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B35%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B36%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B37%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B38%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B39%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B40%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B41%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B42%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B43%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B44%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B45%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B46%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B47%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B48%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B49%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B50%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B51%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B52%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B53%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B54%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B55%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B56%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B57%5D%20UINT16%20519%3CBR%20%2F%3Eperiod%5B58%5D%20UINT16%20%3CSTRONG%3E30879%3C%2FSTRONG%3E%3CBR%20%2F%3Eperiod%5B59%5D%20UINT16%20519%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EAny%20help%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2392368%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K344%20-%20EMIOS%20-%20IPM%20(Input%20Period%20Measurement)%20erroneous%20data%20acquisition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2392368%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F248917%22%20target%3D%22_blank%22%3E%40fede_ls%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CDIV%3EYour%20polling%20logic%20is%20probably%20not%20the%20primary%20source%20of%20the%20observed%20outliers.%20The%20values%20strongly%20suggest%20that%20the%20period%20calculation%20does%20not%20handle%20the%20rollover%20of%20the%20selected%20counter%20bus%20correctly.%20The%20current%20expression%20%3CCODE%3E(uint16_t)(A%20-%20B)%3C%2FCODE%3E%20assumes%20a%20full%2016-bit%20counter%20rollover%20at%2065536%2C%20but%20your%20counter%20bus%20F%20appears%20to%20roll%20over%20at%20approximately%2035176%20ticks.%20Therefore%2C%20whenever%20the%20captured%20period%20crosses%20the%20counter%20rollover%2C%20an%20additional%20offset%20of%20%3CCODE%3E65536%20-%2035176%20%3D%2030360%3C%2FCODE%3E%20ticks%20is%20added%2C%20which%20exactly%20matches%20the%20observed%20outliers.%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3EPlease%20check%20the%20period%2Fmodulus%20configured%20for%20CH22%2C%20which%20is%20used%20as%20counter%20bus%20F%20for%20the%20IPM%20channel.%20The%20period%20should%20be%20calculated%20using%20this%20actual%20counter%20bus%20modulo%20value%2C%20not%20using%20implicit%2016-bit%20unsigned%20subtraction.%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3EPavel%3C%2FP%3E%3C%2FLINGO-BODY%3E