This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • TI Thinks Resolved

CCS/UCD3138HSFBEVM-029: Ucd3138

Prodigy 80 points

Replies: 2

Views: 48

Part Number: UCD3138HSFBEVM-029

Tool/software: Code Composer Studio

Hi everyone,

I am using UCD3138HSFBEVM, i have refereed some videos in ti website, first thing is i have to write code for obtaing dpwm signals, i have attached code below.

I am not getting DPWM signal could you please tell me where am i going wrong?

#define MAIN 1

#include "system_defines.h"
#include "Cyclone_Device.h"
#include "pmbus_commands.h"
#include "pmbus_common.h"
#include "pmbus_topology.h"
#include "variables.h"
#include "function_definitions.h"
#include "software_interrupts.h"
#include "cyclone_defines.h"
#include "stdio.h"

#define PCLK_PERIOD         4.0e-9
#define PERIOD_SECONDS      10.0e-6
#define PERIOD_CLK          ((int)(PERIOD_SECONDS/PCLK_PERIOD)<<4)
#define EVENT1              (int)(PERIOD_CLK*0.00)


int ram_event2;

void inti_dpwm(void)
{
    Dpwm0Regs.DPWMCTRL0.bit.PWM_MODE = 0;  // Set to normal mode
    Dpwm0Regs.DPWMCTRL0.bit.CLA_EN = 0;



    Dpwm0Regs.DPWMPRD.all = PERIOD;
    Dpwm0Regs.DPWMEV1.all = EVENT1;

    Dpwm0Regs.DPWMCTRL0.bit.PWM_EN = 1;
    LoopMuxRegs.GLBEN.bit.DPWM0_EN = 1;
}

void main()
{
  
	if(GioRegs.FAULTIN.bit.FLT3_IN == 0)// Re-Check pin assignment (ADC_EXT/SYNC may be?)
	{
	    //clear_integrity_word();
	}

#if (UCD3138|UCD3138064)
	MiscAnalogRegs.CLKTRIM.bit.HFO_LN_FILTER_EN = 0;
	MiscAnalogRegs.CSTRIM.bit.RESISTOR_TRIM =23; //28;
#endif //(UCD3138|UCD3138064)

	init_pmbus(0x58);
	init_dpwm0();
	ram_event2 = Dpwm0Regs.DPWMEV2.all;

	for(;;)
	    {

	        pmbus_handler();
	        Dpwm0Regs.DPWMEV2.all = ram_event2;

	    }
	}

Thanking you.

  • I don't see anything obviously wrong with it, except that you are calling init_dpwm0, and the function is called init_dpwm.

    But I'm not a compiler or a UCD3138, so I'm not a very good judge.  

    Whenever I have to get a DPWM going, I start with an existing code, in this case, probably the lab codes which go with the videos, and change it from there, as quickly as I dare, which is often not very quickly, especially if the quick change doesn't work the first time.  

    That's the course I'd suggest for you.  

    Happy Debugging,

    Ian Bower

  • In reply to Ian Bower:

    Thank you for replying.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.