How to periodically trigger the FTM using the PDB?

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

How to periodically trigger the FTM using the PDB?

ソリューションへジャンプ
967件の閲覧回数
arthuradmiraal
Contributor I

Hello everybody!

I am trying to periodically trigger the FTM using the PDB. The problem is that the FTM is only triggered once, not periodically, as suggested by this oscilloscope screenshot:SignalScreenshot.png

I have configured the FTM interrupt to stop the FTM after a pulse and then re-initialise it, so that it will produce another pulse when triggered by a sync signal. The first pulse in the image is caused by the initialisation of the FTM, and the second pulse is caused by the PDB triggering the FTM.

Afterwards, the PDB just simply doesn't seem to trigger the FTM anymore.

The PDB is setup using the following KSDK code:

pdb_config_t pdbConfigStruct;

PDB_GetDefaultConfig(&pdbConfigStruct);

pdbConfigStruct.triggerInputSource = kPDB_TriggerInput4;

PDB_Init(PDB0, &pdbConfigStruct);

PDB_SetModulusValue(PDB0, 1000U);

PDB_SetCounterDelayValue(PDB0, 0U);

PDB0->CH[1].C1 = PDB_C1_BB(0b00) | PDB_C1_TOS(0b00) | PDB_C1_EN(0b01); PDB_DoLoadValues(PDB0);

My current guess is that the pre-trigger lock as described in page 884 of the reference manual isn't being cleared, since I am not using the ADC, thus preventing further triggers. However, I have tried to initialise the ADC and to clear the sequence errors as described in page 5 of appnote AN4822, but all to no avail. In fact, clearing the sequence errors seemed to irrecoverably stop the PDB.

A more knowledgeable opinion is greatly appreciated.

ラベル(1)
タグ(2)
0 件の賞賛
返信
1 解決策
669件の閲覧回数
arthuradmiraal
Contributor I

Hello Jorge Alcala,

Thank you for your time.

I am sorry for the late reply, but in the meantime I managed to find out what caused the problem. I will document the solution here for future reference.

I had the HWTRIGMODE bit of the SYNCONF register set 0, so that the FTM would clear the hardware trigger settings every time it was triggered. After the first pulse the FTM generated, it erased the hardware trigger settings, so that it could never be triggered again, hence why I only got a single pulse.

Setting the bit using:

FTM0->SYNCONF |= 1;

solved my issue.

Best regards,

Arthur Admiraal

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
669件の閲覧回数
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Arthur Admiraal

Could you explain how you set the FTM trigger? it was made in the interrupt?.

Also are you triggering your PDB with PIT Ch 0 Output? PDB_GetDefaultConfig function set pdbConfigStruct.enableContinuousMode = false;  So it is configured in One-Shot mode, if you want your PDB operates in continues mode you need to set this option in true.

Waiting for you reply, please let me know if you have any other question.
Have a great day,
Jorge Alcala

0 件の賞賛
返信
670件の閲覧回数
arthuradmiraal
Contributor I

Hello Jorge Alcala,

Thank you for your time.

I am sorry for the late reply, but in the meantime I managed to find out what caused the problem. I will document the solution here for future reference.

I had the HWTRIGMODE bit of the SYNCONF register set 0, so that the FTM would clear the hardware trigger settings every time it was triggered. After the first pulse the FTM generated, it erased the hardware trigger settings, so that it could never be triggered again, hence why I only got a single pulse.

Setting the bit using:

FTM0->SYNCONF |= 1;

solved my issue.

Best regards,

Arthur Admiraal

0 件の賞賛
返信