infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 10 of 10

Thread: Xmc4400 | pwm + dma

  1. #1
    Beginner Beginner rickard.eklof is on a distinguished road
    Join Date
    Aug 2016
    Posts
    17
    Points
    73.75

    Xmc4400 | pwm + dma

    Hi,

    We want to generate a PWM output signal on one channel without CPU interaction. It can be CCU40 or CCU80, we have no preference.

    The setup is:
    1) Timer module generates pulses at a certain interval
    2) DMA module is triggered by the pulses generated in (1). On every pulse, it transfers a 16-bit value to the PWM period match register.
    3) The PWM module is running, but it does not update the period match register.

    The problem is the shadow transferring mechanism. I can successfully update the PWM period match register with DMA, but according to the datasheet I also need to manually write to the shadow transfer enable register with the CPU.
    Is it possible to trigger a shadow transfer without the need for CPU interaction?

    I see that there is a connection between the POSIF module and the shadow transfer enable pin (hardware). Can I use this functionality somehow to address my problem?

    The purpose is to play an audio file without CPU interaction.

    Thanks
    Rickard

  2. #2

    Infineon Employee
    Infineon Employee
    jferreira will become famous soon enough
    Join Date
    Oct 2012
    Posts
    599
    Hi,

    Have a look to the attached project.

    Regards,
    Jesus
    ?????
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  3. #3
    Beginner Beginner rickard.eklof is on a distinguished road
    Join Date
    Aug 2016
    Posts
    17
    Points
    73.75
    Thanks, that is just what I'm looking for!

    However I still have a problem with memory size. In your example - and also in other DMA <-> peripheral devices - the buffer is using 4 byte (uint32_t) values. The peripheral destination value I want to set is only 16 bits, so there is no need for the extra 2 bytes. We need to save RAM so we would like to only use 16-bit values in the buffer.

    I have tried setting the transfer width of both source and destionation to XMC_DMA_CH_TRANSFER_WIDTH_16 in the DMA, but it does not work.
    I have also tried setting the transfer width of source to XMC_DMA_CH_TRANSFER_WIDTH_16, and destination to XMC_DMA_CH_TRANSFER_WIDTH_32, but it doesn't work either.

    Is there a way to perform generic DMA transfer from 16-bit values to 32-bit registers?

    Thanks
    Rickard

  4. #4
    Beginner Beginner rickard.eklof is on a distinguished road
    Join Date
    Aug 2016
    Posts
    17
    Points
    73.75
    Hi again,

    The sample code that you provided works as intended. However there are still some features that are not included in the sample code. I've tried to get them to work, but I have not had any success yet.

    1) As in my previous post, I need to save RAM so I cannot use 32 bit buffers for the DMA transfers to the CCU unit. I need to setup the DMA to read 8-bit (or 16-bit) values and write them to the 32-bit register of the CCU Compare register.
    Instead of uint32_t duty_cycles[2][48], I would like uint8_t duty_cycles[2][48].

    2) I need to generate an interrupt (to ISR) whenever a block in the linked list has been completed. I tried using the XMC_DMA_CH_EnableEvent() and XMC_DMA_CH_SetEventHandler() functions, but I still do not get into my ISR.

    Thanks
    Rickard

  5. #5
    Beginner Beginner rickard.eklof is on a distinguished road
    Join Date
    Aug 2016
    Posts
    17
    Points
    73.75
    Hello, please answer my question. I'm still working on this and need your help.

    Best regards
    Rickard

  6. #6
    Beginner Beginner rickard.eklof is on a distinguished road
    Join Date
    Aug 2016
    Posts
    17
    Points
    73.75
    Hi,

    Still waiting for an answer.
    Thanks.

  7. #7
    New Member New Member RickyTerzis is on a distinguished road
    Join Date
    Aug 2017
    Posts
    1
    Points
    20
    Hi...i am a new user here. My question regards internal flash sector configuration. In previous versions of jlink software this processor had 10 sectors, 0-7 with the length 16kb, 8-128kb, 9-256kb.
    Sectors 0-7 are logical sectors. In my application first logical sector is used for code and rest for storing some application data.
    This was advantageous since during software download data sectors were not erased. Now, in last 2-3 recent versions of jlink software.
    I noticed that sectors become only 4, 0-64kb, 1-64kb, 2-128kb, 3-256kb. Such organization is causing that application data sectors are erased every time new software is downloaded.
    Why of this change? Do you recommend creating my own jflash configuration file with previous settings?
    Once I create this file, how can I make it use by debugger (isystem-winidea) which is using Jlink as debugging interface.

    smt assembly
    Last edited by RickyTerzis; Oct 6th, 2017 at 01:29 PM.

  8. #8
    Beginner Beginner rickard.eklof is on a distinguished road
    Join Date
    Aug 2016
    Posts
    17
    Points
    73.75
    Hi,

    Any update on my issue?

    Rickard

  9. #9

    Infineon Employee
    Infineon Employee
    jferreira will become famous soon enough
    Join Date
    Oct 2012
    Posts
    599
    Hi,

    See attached modified main.c file to enable 16bit duty cycles and enabling interrupt that signals that a block transfer is finished.

    Regards,
    Jesus
    ?????
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  10. #10
    Beginner Beginner rickard.eklof is on a distinguished road
    Join Date
    Aug 2016
    Posts
    17
    Points
    73.75
    Quote Originally Posted by jferreira View Post
    Hi,

    See attached modified main.c file to enable 16bit duty cycles and enabling interrupt that signals that a block transfer is finished.

    Regards,
    Jesus
    Thanks Jesus, it works just like I wanted.

    Rickard

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.