How to configure OPWMCB Notification to trigger ADC

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to configure OPWMCB Notification to trigger ADC

2,283 次查看
MVR
Contributor IV

Hello everyone,

I'm using S32K344 and S32K3 RTD AUTOSAR 4.4 2.0.1 D2207.

I would like to configure the PWM as OPWMCB (Center aligned Output PWM Buffered) using 6 aligned channels and notification occurring at the beginning of cycle as circled in the image below:

MarcusVR_4-1659640477338.png

I need to use the driver OCU? How I can configure using the MCUXpresso Config Tools?

I have tried to configure with this way:

MarcusVR_0-1659642718991.png

MarcusVR_1-1659641166673.png

MarcusVR_2-1659641190031.png

 

MarcusVR_0-1659641025089.png

 

I was able to do the Emios_OCU notification to work, but it doesn't look right, this isnt the same channel of PWM and I can't configure with the same.

Thanks.

标签 (1)
标记 (3)
0 项奖励
回复
9 回复数

2,168 次查看
kyf
Contributor V

@MVR A work arround that I've though yesterday and probably that I will use too is:

 

1. add an extra OPWMCB channel with in the same Master/Counter Bus with duty cycle 99.99%

2. enable the "Flag generation" on the leading edge of the pulse.

3. trigger BCTU with this flag generated from the leading edge of the 99.99% duty cycle pulse

4. and finally BCTU will handle the ADC conversion accordingly to your needs

 

I hope this helps. If you have thought any other workaround share it let me know.

 

Kind regards,

kyf

0 项奖励
回复

2,151 次查看
MVR
Contributor IV

Hello @kyf,

I saw the BCTU options for configuration but I didn't find any option for link with "flag generation" on PWM channel.

It seems to me that BCTU just work with ADC, doesn't it?

For example:

 

MarcusVR_0-1660135593983.png

For it, I understand that we must work in "Internal Trigger" section, because the another sections are "Bctu ADC notification" (the name itself says it all, ADC notification), "Bctu LIST items" (if BCTU configured with conversion using list of channels in ADC, we must configure this section) and "Result FIFOs" (If configured the ADC conversion result as FIFO, we must configure this section).

So what was left was the "Internal Triggers", and all options are tied with ADC, like, if is the single conversion or not, the data destination of conversion, and so on...

Did you see my configuration using Emios_OCU? The notification worked in underflow/overflow, but not in the same channel configured on PWM. Maybe this is the way but I think that there is some simple detail disturbing it.

 

 

0 项奖励
回复

2,147 次查看
kyf
Contributor V

Did you see my configuration using Emios_OCU? The notification worked in underflow/overflow, but not in the same channel configured on PWM. Maybe this is the way but I think that there is some simple detail disturbing it.

I was reading about Ocu today. It is a MCAL driver. You can't trigger other peripherals with Ocu. You can just create interrupt events that CPU will handle. Maybe I'm wrong but from the little time that I've studied it this is what I've understood. In order to initiate an ADC conversion with OCU you have to use the CPU.

By creating a peripheral Event you can use it in order to trigger other Peripherals do stuff without using the CPU.

 

1. I think that you are right. From BCTU configurations you select the eMIOS chanel that creates the trigger. And you have to set also the eMIOS PWM channel trigger accordingly to your needs from the eMIOS PWM config.

 

2. Also the TRGMUX connect connect the two signals together (OPWMCB flag generated from leading edge and the BCTU ).

-> Please see the image that I've attached bellow and let me know if this helps.

-> Black background is due to DevStyle addon

connect_eMIOSflag_to_BCTUtrigger.jpg

 

I think option 1 is the right solution to this, but it can also be done with option 2. I will try to test them and I'll let you know.

TRGMUX is the "guy" that connects almost everything with everything in those MCUs.

 

 

 

Kind regards,

kyf.

0 项奖励
回复

2,142 次查看
MVR
Contributor IV

Hm, I got it.

About the 2 point, I did it but where is the notification? We didn't configure it... I will test as well, I think that this is the right way.

0 项奖励
回复

2,137 次查看
MVR
Contributor IV

Actually I think that I understood it.

We don't need of notification, this TRGMUX trigger automatically the ADC conversion, right? If so, I think it will work.

 

0 项奖励
回复

2,135 次查看
kyf
Contributor V

Hello @MVR .

Yes, but prefer to use BCTU instead of a direct trigger to ADC conversion with TRGMUX. Because the BCTU peripheral has many many usefull functions for your needs.

Read chapter 57 of the reference manual and you can see how every "part" is connected in order to set-up a system that will make use of the peripherals.

 

At the moment I'm trying to configure :

1. OPWMCB with leading edge flag

2. next this flag will be sent to BCTU peripheral

3. BCTU will trigger the ADC conversion according the the list that I've created

4. when ADC conversion is finished BCTU will inform the DMA that data are ready for transfer

5. DMA will transfer data to the desired buffer

 

Check the block diagram from chapter 57:

PowerConversion_and_MotorControl_block_diagram.jpg

 

Regards,

kyf

0 项奖励
回复

2,129 次查看
MVR
Contributor IV

Cool.

I'm trying here as well.

If it works I will let you know, thanks.

0 项奖励
回复

2,241 次查看
kyf
Contributor V

Hello Marcus.

 

I'm working on a similar case past couple weeks. I think that you should connect the trigger signal generated from eMIOS pwm to BCTU periphera via TRIGMUX peripheral. And after that you have to find the correct configuration of BCTU that will trigger the ADC conversion.

 

I'm working on this as well those days and if I get anywhere near to make it work I'll let you know

 

Sadly documentation regarding S32 DS IDE Configuration tool is quite poor and the terminology of RefManual does not  much with ConfigTool...

 

Kind regards,

kyf

0 项奖励
回复

2,233 次查看
MVR
Contributor IV

Yes, the documentation about it is poor, I will see about what you said.

Thanks,

Marcus

0 项奖励
回复