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.

TMS320F28035: Posssible actions before debugger stops the micro

Part Number: TMS320F28035
Other Parts Discussed in Thread: TIDA-01606, C2000WARE

Hi all,

I am fairly new to TMS320F processors and for the past 10 days I have been using an F28035 on an ISO DIMM card with an inverter from the TDINV3000W050 reference design.
It was a jump in the deep end, but as I believe within the scope of my knowledge - over 40 years of experience in electronics.

Due to my known oversight I destroyed the power transistors of the inverter - the bridge remained on when the debugger stopped the processor while analyzing another code snippet I added.

I survived that, but my ears were badly hurt, fortunately only for 10 minutes Slight smile

In the documentation I read about interrupts, including NMI, and that the debugger uses this interrupt.

Question:
Is there a method to have the power transistors turned off BEFORE the debugger stops the processor, regardless of their current state?

I imagine that the debugger-initiated code will turn off the transistors, and do whatever it needs to do to keep track of other pieces of code in the power stage off state.

I also allow for the fact that a restart with the most important inverter interrupts will not be possible, and everything but those interrupts can be tracked in a given session.

Going further, restarting the code after the debugger could perform a reset of the inverter PWM cycles.

Is this a dream or a real possibility?

Regards

Mariusz

  • Hi Mariusz,

    I am checking with subject matter/device expert who can guide on this. I will get back to you later today.

    Thanks & Regards,

    Santosh

  • Mariusz,

    Sorry to hear about the explosion, and glad you are OK.

    The F28305 device maps a signal called "EMUSTOP" to the Trip Zone submodule of the ePWM on line TZ6.  This can be routed to gate off any/all PWMs in the event of a CPU halt as you have described. TZ5 is connected to the missing clock detect logic, to provide protection for that event as well.

    Technically this is "at the same time" as a halt vs the before you mentioned, but this should safe state things before the lack of control causes an issue(assuming in the 100s of kHz level of loop timings)

    C2000 devices also have a feature in the debugger called "real-time" mode that allows ISRs to continue to be serviced even when the device is halted.  This can be enabled in the CCS IDE as shown below after connection to the target.

    With regard to peripheral behavior, you will see many registers with "FREE" "SOFT" bits, these control what the module will do when emulation is halted.  The default is "00" which halts the module after the current state run if the device is halted, you can change these to "free run" so that they will continue to count/etc even when the device is halted.

    Let me know if this gets you on the right track.

    Best,

    Matthew

  • Hi Matthew,

    Explosion was good because I have 4kVA 400V DC source. I have forgotten to switch on serial safety resisitor after power tests -> classic mistake of the electronic designs Slight smile

    I have just read your explanation.

    It looks very good but I have devices in my home-lab, I will continue today afternoon.
    Now - I will read about subjects you have pointed.

    Probably there will more questions, so I will inform you about progress, for sure Slight smile

    Seriously, i have to understand it, all because in the next step i will go to the:
    TIDA-01606, 10-kW, Bidirectional Three-Phase Three-Level (T-type).

    Thank you

    Regards

    Mariusz

  • Mariusz,

    Thanks for the additional background, let us know if we can be of more assistance.

    Best,
    Matthew

  • Hi Matthew,

    Today i have decided to finalise bidirectional communication with my kit to modify parameters and/or read some values from. 
    I did it just now but I am a bit tired today.

    In the meantime - I have found Trip related  code in original firmware for Pwm1 and Pwm2 modules.

    There is a too big amount of the brand new knowledge for my old head.

    Enough for now Slight smile  - next fights tommorow.

    ****

    Last, but very important question - english isn't my native language and I am a bit confused with this general subject : TRIP.

    I was on the trip in Turkey, Switzerland, ....,  and Trip Advisor sends me some informations.

    I have found several additional meanings using Google translator but  I don't see/understand the core of this name in the micorprocessors industry.

    So, detailed and fool-oriented (enginner friendly) description of this world's meaning would be very appreciated for me Slight smile

    Thnk you in advance and regards

    Mariusz.......................................................................................................................................

  • Mariusz,

    In this context you can think of Trip Zone or Trip Event to be the same as saying a Threshold Break. 

    In the English language this comes from the use of "trip" as a verb vs the noun you had mentioned in your post.  In this sense the verb trip means: catch one's foot on something and stumble or fall  I tend to associate a ePWM TZ with a physical Trip Wire, which would detect if something broke its plane.

    With this in mind a trip event for the PWM is one which has causes a break in a threshold and in turn we want it to have some action, in this case to put the PWM to the inactive state for some duration(either forever ONESHOT, or until the next PWM cycle CBC).

    Hope this helps and appreciate the question.

    Best,

    Matthew

  • Hi Matthew,

    thank you very much.

    Hope I will help you in polish language in the future Slight smile

    And for a good day one of the funniest idiom translation:

    Thank you in advance - we are saying: Thank you from the mountain.

    Regards

    Mariusz

  • Hi Matthew,

    I am studying SPRUI10 and I see TZ6 in TZSEL on bits OSHT6 (13), and CBC6 (5) only.

    So I suppose that I can choose one of those events and enable it.

    In the next step I should configure action for pwm in TZ:

    EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_LO;
    EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_LO;

    Next I should enable TZ interrupt.
    Register: TZEINT.OST

    I think that before interrupt service starts PWM will be off.

    After firing the interrupt TZFLG register shows what has happened.
    I can reset all data for PWM to have soft restart and clear flags in TZFLG.

    (Currently I don't know yet what the name for the interrupt service should be, but I think that this is to find somewhere.)

    It all makes sense if we are in debug state now, PWM is prepared for micro restart and I can check another code and restart micro.

    Am I right?

    Thank you from the mountain for attention Slight smile.

    Regards

    Mariusz

  • Hi Matthew,

    I am in home-lab and I have prepared code as below.

    Code shows what I have understood, but unfortunatelly doesn't work Disappointed - I have expected that LED (GPIO34) will go on when I make break in code.

    On PWM1 Init
    EALLOW;   
    	EPwm1Regs.TZSEL.bit.OSHT6 = 1;
        EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_LO;
        EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_LO;
    
        EPwm1Regs.TZFRC.bit.OST = 1;
        EPwm1Regs.TZEINT.bit.OST = 1;
    EDIS;
    
    On PWM2 Init
    EALLOW;
        EPwm2Regs.TZSEL.bit.OSHT6 = 1;
        EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_LO;
        EPwm2Regs.TZCTL.bit.TZB = TZ_FORCE_LO;
    
        EPwm2Regs.TZEINT.bit.OST = 1;
        EPwm2Regs.TZFRC.bit.OST = 1;
    EDIS;
    
    main:
    //prototypes
    interrupt void epwm1_TZINT_isr(void);
    interrupt void epwm2_TZINT_isr(void);
    
    //main
    
    EALLOW;
    
    PieVectTable.EPWM1_INT = &epwm1_isr;
    PieVectTable.EPWM3_INT = &epwm3_isr;
    PieVectTable.EPWM1_TZINT = &epwm1_TZINT_isr;
    PieVectTable.EPWM2_TZINT = &epwm2_TZINT_isr;
    
    EDIS;
    
    //ISR code in main file.
    // EPWM-1
    interrupt void epwm1_TZINT_isr(void){
        GpioDataRegs.GPBCLEAR.bit.GPIO34 = 1;
    }
    // EPWM-2
    interrupt void epwm2_TZINT_isr(void){
        GpioDataRegs.GPBCLEAR.bit.GPIO34 = 1;
    }

    What is wrong?
    Regards
    Mariusz

  • Mariusz,

    It may be in earlier in the code but we need to make sure the GPIO34 is set as an output:

        EALLOW;
        GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 0;   //make sure GPIO 34 is in I/O mode
        GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1;    //make GPIO34 and Output
        EDIS;

    Then in your ISR instead of just a Clear command, let's put a toggle so we don't have to keep up with the state(for now)

    GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1;
    asm(" rpt#255 ||nop")       /insert 256 cycles of delay to hold the state
    GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1;
    asm(" rpt#255 ||nop")       /insert 256 cycles of delay to hold the state

    Let's see if this works.  There is also GPBSET registers if you want to do the SET/CLEAR manually.  Toggle for debug will be a bit simpler as mentioned.

    There is a more comprehensive example here in C2000Ware  C:\ti\c2000\C2000Ware_4_01_00_00\device_support\f2803x\examples\c28\gpio_toggle

    Best,

    Matthew

  • Hi Matthew,

    GPIO settings should be ok because of their presence in working eveluation kit.
    This is an error LED, and in fact I haven't checked if really works, I will do it.

    All my code snippets are added to the working inverter software (power hardware is dead)

    Important for me is if I have good understóod configurations, so if my settings in epwm1 and epwm2 and TZ registers are ok.

    You haven't wrote nothing about this part of my works - is it ok?

    Regards

    Mariusz

  • Mariusz,

    I had mis-understood the issue, you are saying that the PWM settings are not resulting in the PWM output going low when there is a breakpoint event in the code.

    Since the EMUSTOP comes in from the DC module, let's try this example C:\ti\c2000\C2000Ware_4_01_00_00\device_support\f2803x\examples\c28\epwm_dcevent_trip

    I may need to pull in the ePWM expert, we are out of the office tomm for US holiday, so please expect the next TI reply by Tuesday US time.

    Best,

    Matthew