Skip to main content
kjay
Associate III
July 1, 2019
Solved

how to configure flex pwm to give complementary pwm of 20 khz.

  • July 1, 2019
  • 59 replies
  • 27260 views

.i need help with calculating clock and time peroid and waht is other pwm pin if pwm0 has d10 which is complemetary pin in spc56el70l5-disp

    This topic has been closed for replies.
    Best answer by zambrano.luigi

    Hi,

    as already explained, when the synchronization is enabled, all the submodules are managed as a unique driver with 8 channels (ch0 = A0, ch1 = B0, ch2 = A1, ch3 = B1, ch4 = A2, ch5 = B2, ch6 = A3, ch7 = B3). So, if you want to enable the outputs A1 and B1, you have to activate in the PWM configuration the channels 2 and 3 (see Sync_Conf.JPG in attachment). In attachment you can find the modified version of your project in which I have enabled the channels A0, B0, A1 and B1 (in particular, I have configured B0 as the complementary of A0 and B1 as the complementary of A1). In the picture Sync_PWM_Waveforms.JPG you can see the output waveforms.

    Best Regards,

    Luigi

    59 replies

    zambrano.luigi
    ST Employee
    July 1, 2019

    Hi,

    let me suggest you to download SPC5Studio from ST web site. It is a tool that allows you to easily configure our cores and generate specific applications for them. It also contains a lot of examples. Some of these are specific for the FlexPWM configuration. In attachment you can find an SPC5Studio project in which the FlexPWM0 of the core SPC56EL70L5 is configured to generate 2 complementary PWM signals with a duty cycle of 50% and a frequency of 20KHz, the PWMA0 on the pin D[10] and the PWMB0 on the pin D[11]. The project has been developed for the development board SPC56EL70L5DISP (Discovery Kit for the L Line.) , on which the pin D[10] is connected with the pin B23 on the external connector X6, and the pin D[11] is connected with the pin B3 on the external connector X6.

    Best Regards,

    Luigi

    kjay
    kjayAuthor
    Associate III
    July 2, 2019

    thank you so much .... i have doubt how to vary duty like 0-100.pwm_lld_enable_channel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000)); here i change 5000 but it is not working total frequency u have is 80 Mhz and period of 400. is it like varying value 0-400 to percentage 0-100. that is also not working.

    zambrano.luigi
    ST Employee
    July 3, 2019

    Hi, 

    in the example that I provided you, the third parameter of the function pwm_lld_enable_channel is the duty cycle. The value PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000) means you is setting a duty cycle of 50% of the whole PWM period. For example, if you change it to PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 2500), you will have a duty cycle of 25% of the whole PWM period. The PWM period is obtained as number of ticks of the Clock Frequency (set to 80MHz in the project that I shared with you). In particular, a period of 400 ticks means the the PWM period is 400 / 80MHz = 5ms, i.e. the PWM frequency is 1 / 5ms = 20KHz. If you want to change the period, you can modify the Clock Frequency or you can modify the number of ticks. But, please, consider that the Clock Frequency is obtained by the Motor Control clock by dividing it for a prescaler, and the value of the prescaler can be 1, 2, 4, 8, 16, 32, 64 or 128. So, it is not possible to set any value for the Clock Frequency. In the project that I shared with you the Motor Control clock frequency is set to 80MHz and alsi the Clock Frequency is also set to 80MHz, so the prescaler is automatically configured to 1. 

    Best Regards,

    Luigi

    kjay
    kjayAuthor
    Associate III
    July 12, 2019

    can you help me to get simple CAN transmission and reception using interrupts

    with standard CAN in normal mode ..i find that example in spc studio difficult and hard to understand..

    zambrano.luigi
    ST Employee
    July 12, 2019

    Hi,

    the best way to proceed is a cross check between the FlexCAN low level driver included in SPC5Studio and the Reference Manual of the core. Then, if you will find a specific topic, please, feel free to contact us on the forum.

    Best regards,

    Luigi

    kjay
    kjayAuthor
    Associate III
    July 3, 2019

    thank you ..you have been very helpful..

    kjay
    kjayAuthor
    Associate III
    July 24, 2019

    i have an issue with reset pin .it always gives me ground which leads to glowing led ..my jtag programmer UDESTK is not finding and not connecting any configuration for program..i have been using spc56el60l5 ic and spc56el70 discovery board ..in discovery board all seems working fine..but i try to replicate this schematic with my own pcb design jtag problem arises ..i am using the attached schematic and basic working operation from it ..please help me out for programming ic with my own design..i followed all capacitors and resistors i will attach my PCB as well please point me out what am i missing here??...

    kjay
    kjayAuthor
    Associate III
    July 24, 2019
    zambrano.luigi
    ST Employee
    July 24, 2019

    Hi,

    from your description, it seems an issue not directly connected with the JTAG/Debugger. In any case, I have checked the connections between the core and the JTAG, and they seems ok. In order to address the issue, I have the following questions for you:

    1. Have you ever been able to connect the UDE PLS debugger with your board? In particular, with the UDE PLS debugger, please, go in Config->Target Interface, select the tab "E200 Core", flag "Use Hardware Reset Mode" and select as Mode "Execute boot code". Then, try to reset again the core from the debugger.
    2. Have you tried to connect a different debugger? (i.e. Lauterbach).

    If, as I believe, the issue is not related to debugger, let me suggest you to check the power supply for the core and the circuit connected the reset push button in order to be sure that it doesn't force to reset when the button is not pushed.

    Best Regards,

    Luigi

    kjay
    kjayAuthor
    Associate III
    July 24, 2019

    I HAVE NOT ISSUE WITH DEBUGGER IT WORKS WELL with discovery board ..problem is reset is always low ...it is been pulled low by controller..i try to connect debugger it is not picking a target ..i triple chequed power supply it seems legit...as well as master reset ic..i read datasheet of spc56el60l5..it talks about internal reset sequence..i have no clarity on that but that reset is always pulled low by controller. help me to find out problem. is core is properly ciruited ...

    zambrano.luigi
    ST Employee
    July 26, 2019

    Hi,

    in order to address your issue, please, consider the following steps:

    1. Could you check that the core power supplies (in particular, VDD_LV_COR) are stable and respect datasheet levels?
    2. Could you provide me the whole part number of the device on which your board is based on? (also a picture)
    3. Could you cut on your board the connection between the reset circuit and the device? In this way, we can exclude that the issue is in the reset circuit.

    Best Regards,

    Luigi

    kjay
    kjayAuthor
    Associate III
    July 26, 2019

    i tried to cut down reset circuit issue is core is giving ground..

    lvcor is fine with 1.2v constant..

    par number is spc56el60l5ccosr

    kjay
    kjayAuthor
    Associate III
    July 26, 2019

    now core is connected but it is always reestablishing connection..cant allow to program

    kjay
    kjayAuthor
    Associate III
    July 26, 2019

    core inactive no lockstep mode is detected message from debugger