infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 5 of 5

Thread: CCU8 and DMA at XMC4700

  1. #1
    New Member New Member CHRichter is on a distinguished road
    Join Date
    Sep 2018
    Posts
    3
    Points
    40

    CCU8 and DMA at XMC4700

    Hello,
    i'm trying to transfare Data from Memory to the Shadow-Register from the CCU8, but i've never before Worked with the DMA an i dont get ist to Work...
    I finally don't understand the lots of Settings an how they Work together. Is there anyone, who can explain me this a little bit?

    Thanks,
    Christoph

  2. #2
    New Member New Member CHRichter is on a distinguished road
    Join Date
    Sep 2018
    Posts
    3
    Points
    40
    Ok, no Person works with Dave it seems...
    I expected more from this Forum here, but seems, I've looking at an other place....

  3. #3
    New Member New Member Daniel.Sanchez is on a distinguished road
    Join Date
    Aug 2018
    Location
    Brazil
    Posts
    5
    Points
    150
    Yeah! It is ridiculous. Nobody seems to take care of this forum.
    I am thinking: How Infineon expects that peoples like us change from Microchip or any other microcontroller manufacturer, if nobody looks for the forums?

  4. #4

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

    Have a look at the example XMCLib\examples\XMC4800_series\DMA\DMA_PWM which you will find at http://dave.infineon.com/Libraries/X...ry_v2.1.18.zip

    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.

  5. #5
    New Member New Member CHRichter is on a distinguished road
    Join Date
    Sep 2018
    Posts
    3
    Points
    40
    Hi,
    now I oriantated me at the Example, but it dosn't work and i coudn't find the mistake...

    Code:
    #include <XMC4700.h>
    #include <xmc_dma.h>
    #include <xmc_uart.h>
    #include "xmc_spi.h"
    #include "xmc_gpio.h"
    
    #define TICKS_PER_SECOND 1000
    #define TICKS_WAIT 20
    
    
    // Sys-Tick Counter
    #define CORE_SysTickEn()    (*((uint32_t*)0xE0001000)) = 0x40000001
    #define CORE_SysTickDis()   (*((uint32_t*)0xE0001000)) = 0x40000000
    #define CORE_GetSysTick()   (*((uint32_t*)0xE0001004))
    
    #define SPI_MASTER_MISO P0_0
    #define SPI_MASTER_MOSI P0_1
    #define SPI_MASTER_SS   P0_9
    #define SPI_MASTER_SCLK P0_10
    
    #define SPI_SLAVE_MISO P0_5
    #define SPI_SLAVE_MOSI P1_4
    #define SPI_SLAVE_SS   P1_0
    #define SPI_SLAVE_SCLK P1_1
    
    #define LEDS 784
    #define BUFFER_LENGTH (LEDS*2)+4
    #define LEDDATABUFFER 1
    
    #define BRIGHTNES 0x1F
    
    #define APA102_STARTFRAME (uint32_t)0x00000000
    #define APA102_STOPFRAME	(uint32_t)0xFFFFFFFF
    
    
    void sendAPA102(uint32_t  LedData[1][4]);
    
    XMC_USIC_CH_t *spi_master_ch = XMC_SPI1_CH1;
    
    uint16_t buffer[BUFFER_LENGTH];
    
    volatile bool transfer_done = false;
    
    uint32_t LedData[LEDDATABUFFER][4] = {
    {0x00,0x01,0x00,BRIGHTNES}};			//LED-Number + RGBS
    uint32_t * LedData_ptr = &LedData[0][0];			//LED-Number + RGBS
    
    XMC_DMA_CH_CONFIG_t dma_ch_config_master =
    {
      .src_addr = (uint32_t)&(buffer[0]),
      .dst_addr = (uint32_t)&(USIC1_CH1->TBUF[0]),
      .block_size = BUFFER_LENGTH,
      .src_transfer_width = XMC_DMA_CH_TRANSFER_WIDTH_16,
      .dst_transfer_width = XMC_DMA_CH_TRANSFER_WIDTH_16,
      .src_address_count_mode = XMC_DMA_CH_ADDRESS_COUNT_MODE_INCREMENT,
      .dst_address_count_mode = XMC_DMA_CH_ADDRESS_COUNT_MODE_NO_CHANGE,
      .src_burst_length = XMC_DMA_CH_BURST_LENGTH_1,
      .dst_burst_length = XMC_DMA_CH_BURST_LENGTH_1,
      .transfer_flow = XMC_DMA_CH_TRANSFER_FLOW_M2P_DMA,
      .transfer_type = XMC_DMA_CH_TRANSFER_TYPE_SINGLE_BLOCK,
    
      .dst_handshaking = XMC_DMA_CH_DST_HANDSHAKING_HARDWARE,
      .dst_peripheral_request = DMA0_PERIPHERAL_REQUEST_USIC1_SR0_0, 		// SR = 1, Line = 2;
    
      .enable_interrupt = true
    
    };
    
    
    
    
    
    
    
    
    XMC_SPI_CH_CONFIG_t spi_master_config =
    {
      .baudrate = 5000,
      .bus_mode = XMC_SPI_CH_BUS_MODE_MASTER,
      .selo_inversion = XMC_SPI_CH_SLAVE_SEL_INV_TO_MSLS,
      .parity_mode = XMC_USIC_CH_PARITY_MODE_NONE
    };
    
    
    void GPDMA0_0_IRQHandler(void)
    {
      transfer_done = true;
      XMC_DMA_CH_ClearEventStatus(XMC_DMA0, 2, XMC_DMA_CH_EVENT_BLOCK_TRANSFER_COMPLETE);
    }
    
    /* ------------------------------------------------------------------ */
    void SysTick_Handler(void)
    {
      static uint32_t ticks = 0;
      ticks++;
      if (ticks == TICKS_WAIT)
      {
    		
    		sendAPA102(LedData);
        ticks = 0;
      }
    }
    
    /* ------------------------------------------------------------------ */
    uint32_t makeLedFrame(uint8_t R, uint8_t G, uint8_t B, uint8_t S) {
    	uint32_t LedFrame;
    	LedFrame = 0;
    	LedFrame = (LedFrame | 0x7) << 3;
    	LedFrame = (LedFrame | S) << 5;
    	LedFrame = (LedFrame | B) << 8;
    	LedFrame = (LedFrame | G) << 8;
    	LedFrame = LedFrame | R;
    	return(LedFrame);
    }
    /* ------------------------------------------------------------------ */
    void sendAPA102(uint32_t  LedDataToSend[LEDDATABUFFER][4]) {
    	uint32_t j = 2, LedFrame;
    	uint32_t Debug;
    	buffer[0] = (APA102_STARTFRAME & 0xFFFF0000)>>4;
    	buffer[1] = APA102_STARTFRAME & 0x0000FFFF;
    	
    		for(uint32_t i = 0; i<LEDS; i++) {		
    			LedFrame = makeLedFrame(LedDataToSend[0][0],LedDataToSend[0][1],LedDataToSend[0][2],LedDataToSend[0][3]);
    			buffer[j] = ((LedFrame & 0xFFFF0000) >> 16);
    			buffer[j+1] = LedFrame & 0x0000FFFF;
    			j=j+2;
    		}
    
    	buffer[BUFFER_LENGTH-2] = ((APA102_STOPFRAME & 0xFFFF0000) >> 16);
    	buffer[BUFFER_LENGTH-1] = APA102_STOPFRAME & 0x0000FFFF;
      
      XMC_DMA_CH_Enable(XMC_DMA0, 2);
    	while (transfer_done == false);
    	transfer_done = false;
    
    }
    /* ------------------------------------------------------------------ */
    int main(void)
    {
    
    
      /* Start sending periodic message */
      SysTick_Config(SystemCoreClock / TICKS_PER_SECOND);
    
    
      /* ------------------------------------------------------------------------- */
    
      	  	  	  	  	  	  /*    MASTER      */
      /* ------------------------------------------------------------------------- */
    #if 1
      /*Initialize and Start SPI Master*/
      XMC_SPI_CH_Init(spi_master_ch, &spi_master_config);
    	XMC_SPI_CH_SetWordLength(spi_master_ch, 32);
    	XMC_SPI_CH_SetFrameLength(spi_master_ch, (32));
      USIC1_CH1->PCR_SSCMode = 0x8001000F;				// CS = LowActive
    
      /*Input source selected for Master*/
      XMC_SPI_CH_SetInputSource(spi_master_ch,XMC_SPI_CH_INPUT_DIN0,USIC1_C1_DX0_P0_0);		// MISO
    
      /*GPIO configuration for Master*/
      XMC_GPIO_SetMode(SPI_MASTER_MOSI, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2);
      XMC_GPIO_SetMode(SPI_MASTER_SS, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2);
      XMC_GPIO_SetMode(SPI_MASTER_SCLK, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2);
      XMC_GPIO_SetMode(SPI_MASTER_MISO, XMC_GPIO_MODE_INPUT_TRISTATE);
    #endif
      /* ------------------------------------------------------------------------- */
    
      	  	  	  	  	  	 /*    SLAVE      */
      /* ------------------------------------------------------------------------- */
    
    
    
      /* ------------------------------------------------------------------------- */
    
      	  	  	  	  	  	/*    MASTER  DMA     */
      /* ------------------------------------------------------------------------- */
    #if 1
      XMC_DMA_Init(XMC_DMA0);
      XMC_DMA_CH_Init(XMC_DMA0, 2, &dma_ch_config_master);
    	XMC_DMA_CH_EnableEvent(XMC_DMA0, 2, XMC_DMA_CH_EVENT_BLOCK_TRANSFER_COMPLETE);
    	
    	NVIC_SetPriority(GPDMA0_0_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 63, 1));
    	
      NVIC_EnableIRQ(GPDMA0_0_IRQn);
    	
    
     
    
    	
    	XMC_SPI_CH_EnableEvent(XMC_SPI1_CH1, XMC_SPI_CH_EVENT_TRANSMIT_BUFFER);
      XMC_USIC_CH_SetInterruptNodePointer(XMC_SPI1_CH1 , XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER,1);
    	
    	
      XMC_SPI_CH_EnableEvent(XMC_SPI1_CH1, XMC_SPI_CH_EVENT_TRANSMIT_SHIFT);
    
    	
      XMC_SPI_CH_TriggerServiceRequest(XMC_SPI1_CH1, 0); /* make DMA ready */
    #endif
      /* ------------------------------------------------------------------------- */
    
      	  	  	  	  	  	/*    SLAVE  DMA     */
      /* ------------------------------------------------------------------------- */
    
      /* ------------------------------------------------------------------------- */
    
    
      /* ------------------------------------------------------------------------- */
    #if 1
    
     // USIC0_CH0->DX2CR |= 0x1 << 8;			// ?
    
      XMC_SPI_CH_Start(spi_master_ch);
    
    
    #endif
    
    	
     
    		
     
    
      
    
    while(1) {
    	
    }
    
    
    	 
    }

+ Reply to 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.