EMIOS Input Capture S32DS SDK 3.0.3 - MPC5748G

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

EMIOS Input Capture S32DS SDK 3.0.3 - MPC5748G

1,296件の閲覧回数
Bobkat
Contributor II

HI,

I'm trying to use EMIOS input capture SDK functions to measure both the period and duty of a PWM waveform.

The SDK driver seems to have three modes, 'Single capture mode', 'Period measurement mode' and 'Pulse width measurement mode'.

I'm probably missing something simple, but there doesn't seem to be a way to switch modes during runtime, i.e. there's no driver function available and there doesn't seem to be a way of assigning the same channel to another instance of the 'emios_ic' driver.

I would greatly appreciate any help with this matter.

Best regards

 

Rob

0 件の賞賛
8 返答(返信)

1,287件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you can try below sequence to deinit channel and init again with new config

EMIOS_DRV_ChannelDisableInterruptRequest
EMIOS_DRV_DeInitChannel
EMIOS_DRV_ClrFlagState
EMIOS_DRV_IC_InitInputCaptureMode
EMIOS_DRV_ChannelEnableInterruptRequest

BR, Petr

0 件の賞賛

1,268件の閲覧回数
Bobkat
Contributor II

HI Petr,

Thanks for the instructions.

Not sure what I'm doing wrong....

The command 'EMIOS_DRV_IC_InitInputCaptureMode' requires a config to be specified as the last parameter.

If I try to specify a new config in processor expert, i.e. a config using the same channel but different sub-mode value, it comes up with 'This channel was used by other Input Capture mode configuration'.

Is there a way around this or to disable the error/warning?

Best regards

 

Rob

0 件の賞賛

1,254件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

do not specify new config in PE, try to modify existing one or define new in the code.

BR, Petr 

0 件の賞賛

1,243件の閲覧回数
Bobkat
Contributor II

Hi Petr,

Again, thanks for the info.

Have manage to get a period and pulse measurement being undertaken alternately using the methods you suggested. However, it's a little ungainly.

Have noticed that the Single Capture Mode can be used and triggered on both rising and falling edges. This in theory would allow me to calculate the PWM period and duty using a single configuration as long as I could tell if it was a rising or falling edge which triggered the interrupt.

Is there a way to do this, i.e. in the interrupt, via a flag for instance?

Best regards

 

Rob

 

0 件の賞賛

1,233件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

no flag is available for that, the only option is to read UCIN bit of the Status register after edge is detected.

But you can evaluate period/duty using IPM mode too. Just read/save two consecutive measurement, so for each flag/interrupt call EMIOS_DRV_IC_GetLastMeasurement 

BR, Petr

0 件の賞賛

1,227件の閲覧回数
Bobkat
Contributor II

Hi Petr, Sorry for being dense...

If I use Input Period Measurement mode, how can I tell what the duty is from two consecutive readings?

 

Cheers Rob

0 件の賞賛

1,222件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, you are right, my fault, damn...

EMIOS_DRV_IC_GetLastMeasurement is returning single value. For IPM it calculates a difference from captured first and second count. 

Well, maybe modify existing driver or create own function to have both values or first and difference?

BR, Petr

0 件の賞賛

1,170件の閲覧回数
Bobkat
Contributor II

HI Petr.

Sorry for the late reply - xmas holidays.

Hope you had a good xmas.

Only low frequency (< 50Hz) - so will probably just read the pin value every millisecond.

Cheers

 

Rob

0 件の賞賛