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.

CCS/TMS570LC4357: TMS570LC4357

Part Number: TMS570LC4357
Other Parts Discussed in Thread: UNIFLASH, HALCOGEN

Tool/software: Code Composer Studio

Hello

Which file need to be load to TMS570lc4357 controller to actuate a solenoid type mechanical device like pump, injector etc......either HEX file or BIN file.

Kindly reply for this.

Thanking you,

  • Hello,

    TI CCS IDE can generate *.out file in ELF format, and HEX files (Motorola formats, Intel format, TI format, and ASCII text) and binary file. 

    TI CCS Uniflash can load all formats mentioned above to flash of TI MCUs. Uniflash has a GUI, command line, and scripting interface. CCS Uniflash is available free of charge.

    https://www.ti.com/tool/UNIFLASH

    The solenoid has a coil inside it. When energized, it pulls the piston inside it, and when de-energized it pushes the piston back in the previous position. Using PWM to control a solenoid is feasible. The ePWM module and N2HET module on TMS570LC43x device can be programmed to generate PWM signals with specified period and duty cycle.

  • Hi sir,

    When i sent a pwm signal to stepper motor.....signal is propertly received by a motor and it shown error like this:

     Unable to determine target status after 20 attempts

    May I know the solution for this....how can I solve this issue?

    Thanking you,

    SHIVAKUMAR 

  • Don't know what the error message means.

  • Dear Sir,

    Can I use the below mentioned codes to control actuators?

    CAN I USE THE BELOW MENTIONED CODES TO COUNT NUMBER OF TEETH ON THE GEAR WHEEL(TRIGGER WHEEL)...?

    IF NOT PLEASE MENTION AN EXAMPLE CODES TO COUNT THE SAME.......

    CODES:

    int main(void)
    {
    /* USER CODE BEGIN (3) */

    /* Enable CPU IRQ interrupt */
    _enable_interrupt_();

    /* initialize NHET1 based on HalCoGen settings */
    hetInit();

    #if 0 /* Intention of the RTI is to change the speed modes, among constant speed, acceleration and
    and deceleration automatically */
    /* Initialize RTI driver */
    rtiInit();
    /* Enable RTI Compare 0 interrupt notification */
    rtiEnableNotification(rtiNOTIFICATION_COMPARE0);
    /* Start RTI Counter Block 0 */

    /** - Setup compare 0 value. This value is compared with selected free running counter. */
    rtiREG1->CMP[0U].COMPx *= DURATION;

    /** - Setup update compare 0 value. This value is added to the compare 0 value on each compare match. */
    rtiREG1->CMP[0U].UDCPx *= DURATION;
    rtiStartCounter(rtiCOUNTER_BLOCK0);

    #endif

    /* initialize HWAG */
    hwagInit();

    hwagREG1->HWATHNB = 57; // Total number of teeth for a 60-2 tooth wheel
    hwagREG1->HWASTWD = 4; // Step Width = 64
    hwagREG1->HWAGCR2 = 0x00010001; // Start HWAG and enable criterial searching
    hwagREG1->HWAENASET = 0x10; // Enable PCNT(n) > 2 x PCNT(n-1) interrupt, Enable singularity not found interrupt

    /* Configure additional settings of NHET1 based on the macros settings */
    configNHET1();

    while(1);

    /* USER CODE END */

    }


    /* USER CODE BEGIN (4) */

    /*
    * NHET1 CNT instruction will generate interrupt whenever one PWM period
    * is complete
    */
    uint32 index = 0;
    uint32 wheel_spin_count = 0;

    void hetNotification(hetBASE_t *het, uint32 offset)
    {
    uint32 cnt_max_period=0;

    /* speed = 0: constant speed
    * speed = 1: deceleration
    * speed = 2: acceleration
    * currently speed variable is hard coded to one particular mode. In future, the speed value
    * will be determined in the rtiNotification based on RTI interrupt.
    */
    speed = 0;

    if (speed == 0) {
    cnt_max_period = hetRAM1->Instruction[pHET_L03_0].Control;
    } else if ( speed == 1) {
    cnt_max_period = (uint32)(hetRAM1->Instruction[pHET_L03_0].Control * ( 1 + DEC_RATE));
    } else {
    cnt_max_period = (uint32)(hetRAM1->Instruction[pHET_L03_0].Control * ( 1 - ACC_RATE));
    }

    if (cnt_max_period > CNT_MAX_BOUND) {
    cnt_max_period = CNT_MAX_BOUND;
    }

    if (cnt_max_period < CNT_MIN_BOUND) {
    cnt_max_period = CNT_MIN_BOUND;
    }

    if ((het == hetREG1) && offset == (pHET_L01_0+1) )
    {
    if (index == 59)
    {
    index = 0;
    wheel_spin_count++;
    hetRAM1->Instruction[pHET_L03_0].Control = (uint32)cnt_max_period * 3 + 0;
    } else if ((index == 1) && (wheel_spin_count > 0))
    {
    hetRAM1->Instruction[pHET_L03_0].Control = (uint32)(cnt_max_period / 3);
    } else
    {
    hetRAM1->Instruction[pHET_L03_0].Control = (uint32)cnt_max_period;
    }
    index++;
    }
    /* Load 50% duty cycle to NHET program */
    hetRAM1->Instruction[pHET_L01_0].Data = cnt_max_period << 6; // cnt_max_period * 128 / 2

    }
    uint32 hwag_int_count = 0;
    void hwagNotification(hwagBASE_t *hwag, uint32 offset)

    {

    hwag_int_count++;

    if ((hwag == hwagREG1) && offset == 5 ){ //PCNT(n) > 2 x PCNT(n-1)
    gioSetBit(hetPORT1, 12, 1); // set NHET1[12] when entering interrupt, for debug observation

    hwagREG1->HWAGCR2 = 0x00010000; // Disable HWAG from running

    hwagREG1->HWAACNT = 0; // Reset the ACNT
    hwagREG1->HWATHVL = 0; // Reset tooth count
    hetRAM1->Instruction[pHET_L04_0].Data = 0; // Reset the NHET CNT Data field in angle mode
    // hwagREG1->HWAENACLR = 0x10; // Disable PCNT(n) > 2 x PCNT(n-1) interrupt
    hwagREG1->HWAGCR2 = 0x00010001; // Start HWAG

    uint32 i;
    for (i=0;i<100;i++);
    gioSetBit(hetPORT1, 12, 0); // clear NHET1[12] when exiting interrupt, for debug observation
    }

    }

    /* configureNHET1 configures the selected NHET1 pin to output PWM. It
    * also loads the initial PWM period and duty cycle into the NHET1
    * RAM
    */
    void configNHET1()
    {

    /* Set the selected pin to output. */
    hetREG1->DIR = (1 << NHET1_PIN_PWM) | (1 << NHET1_TOOTH_WHEEL) | (1 << 12); //pin12 for observing interrupt

    hetREG1->INTENAS = (1 << pHET_L01_0);

    /* Load the PWM period based on the defined macro to the CNT instruction */
    hetRAM1->Instruction[pHET_L03_0].Control = (uint32)(CNT_MAX_PERIOD) | (hetRAM1->Instruction[pHET_L03_0].Control & 0xFFFD0000);

    /* Configure the pin number to output the PWM */
    hetRAM1->Instruction[pHET_L01_0].Control = (hetRAM1->Instruction[pHET_L01_0].Control & 0xFFFFE0FF) | (NHET1_TOOTH_WHEEL << 8);

    /* Load 50% duty cycle to NHET program */
    hetRAM1->Instruction[pHET_L01_0].Data = CNT_MAX_PERIOD * 128 / 2;

    }

    uint32 count = 0;
    void rtiNotification(rtiBASE_t *rtiREG,uint32 notification)
    {
    speed = count % 3;
    count++;

    }

    /* USER CODE END */

  • hello,

    Have you solved the problem? I don't have experience of using HWAG, so I am sorry I don't have insight into your code.

  • Dear Sir,

     Still it is pending sir.

    From the above coding, I need to get signal after reaching index = 58/59 during each rotation of toothed wheel. 

    Kindly suggest with any alternate examples.

    Thanking you,

    SHIVAKUMAR

  • Hello,

    I don't have hardware to do test for HWAG.