Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
robs1
Level 4
Level 4
100 sign-ins 50 replies posted First solution authored

Hi, this code for one shot up down counting doesn't display anything, which is the error??

 

IfxGtm_enable(&MODULE_GTM); /* Enable GTM */
//SET THE CLOCK SOURCE TO ITS MAXIMUM SO 200 MHZ
gtm_ptr->CTRL.B.RF_PROT=0;//RF_PROT bit cleared in order to set CLK_DIV
gtm_ptr->CLS_CLK_CFG.B.CLS0_CLK_DIV=01;//Set cluster enable without clock divider

IfxGtm_Cmu_setClkFrequency(&MODULE_GTM, clkId, CLK); /* Set the CMU clock 0 frequency */
IfxGtm_Cmu_enableClocks(&MODULE_GTM, IFXGTM_CMU_CLKEN_CLK0); /* Enable the CMU clock 0 */


//First pwm
IfxGtm_Atom_Pwm_initConfig(&g_atomConfig[i], &MODULE_GTM); /* Initialize default parameters */
g_atomConfig[i].atom = OUT_1.atom; /* Select the ATOM cluster */
g_atomConfig[i].atomChannel = OUT_1.channel; /* Select the channel */
g_atomConfig[i].period = PWM_PE; /* Set timer period */
g_atomConfig[i].dutyCycle = duty; /* Set duty cycle */
g_atomConfig[i].signalLevel = Ifx_ActiveState_low;
g_atomConfig[i].mode = IfxGtm_Atom_Mode_outputPwm;
g_atomConfig[i].synchronousUpdateEnabled = TRUE; /* Enable synchronous update */
g_atomConfig[i].pin.outputPin = &OUT_1; /* Set a PIN as output */
g_atomConfig[i].pin.outputMode = IfxPort_OutputMode_pushPull;
//not sure about that
g_atomConfig[i].immediateStartEnabled=FALSE;

IfxGtm_Atom_Pwm_init(&g_atomDriver[i], &g_atomConfig[i]); /* Initialize the PWM */

 

atomSFR = &g_atomConfig[i].gtm->ATOM[g_atomConfig[i].atom]; /* variable for Atom-Channel-Functions */
Ifx_GTM_ATOM_CH *atomCh = IfxGtm_Atom_Ch_getChannelPointer(atomSFR, g_atomConfig[i].atomChannel); /* Pointer to Channel address & Control-Register */

//For one shot mode
atomCh->CTRL.B.OSM=1;
//or function in libreria atom.c
//SOMP.B.OSM=1;


//To set up down counting
atomCh->SOMP.B.UDMODE=0x3;
atomCh->CTRL.B.UDMODE=0x3;

atomSFR->AGC.ENDIS_STAT.B.ENDIS_CTRL0=2;//enable channel

MODULE_GTM.ATOM[0].AGC.OUTEN_CTRL.B.OUTEN_CTRL0= 2; // enable output
// MODULE_GTM.ATOM[0].AGC.GLB_CTRL.B.UPEN_CTRL0=2;//enable shadow transfer
MODULE_GTM.ATOM[0].AGC.ENDIS_CTRL.B.ENDIS_CTRL0=2;// enable channel
MODULE_GTM.ATOM[0].AGC.GLB_CTRL.B.UPEN_CTRL0=0x1;

 

atomCh->CN0.B.CN0=500;//dovrebbe attivare il segnale pwm

0 Likes
2 Replies
Aiswarya_A
Moderator
Moderator
Moderator
25 likes received 250 sign-ins 50 solutions authored

Hi,

You could refer to the section "28.15.3.3.6 One-shot Counting Up-Down Mode" in the AURIXTC3XX_um_part2_v2.0 UM and evaluate at your end that the mentioned points in the section were taken care of. 

Kind Regards,
Aiswarya.

0 Likes

Thank you for your answer but I obviously write this code following that section of user manual! I set all setting told in that section as I attached but it doesn’t work 

0 Likes