XMC™ Forum Discussions
XMC™
Hi all,I am trying to configure the DMA module to read 3 ADC registers and transfer their contents into an array. It is similar to what is described i...
Show More
Hi all,
I am trying to configure the DMA module to read 3 ADC registers and transfer their contents into an array. It is similar to what is described in the following App. Note: http://www.infineon.com/dgdl/Infineon-GPDMA-XMC4000-AP32290-AN-v01_00-EN.pdf?fileId=5546d4624e765da5014ed9145c601e95, Multi block transfer of VADC result registers to RAM for
motor control.
In short, I configured the ADC to take 8 samples, which are distributed among 3 result registers (accumulation mode is ON). When the last conversion is completed and the result becomes available, an SR trigger is fired (e.g. G0SR1) to indicate the availability of all the results. This trigger is routed to GPDMA0, Channel 0, which is configured as follows:
In my understanding, what would happen is as follows:
(a) The DMA would look at VADC_G0->RES[1] (which it does properly, by the way, but I will elaborate on this a little later), take the value from that register and transfer it to variables[0]
(b) The source address would increment by 32 bits (because of gather settings), and would point at VADC_G0->RES[2]
(c) The destination address would increment by 16 bits and would point to variables[1] (Note: variables is an array of type uint16_t)
(d) This process would repeat, starting from (a), but for VADC_G0->RES[2]
However, the problem is that the DMA stalls once it has transferred the values out of RES[1] to variables[0]. In other words, when I look at the RES registers, I can see that the valid flag (VF) of RES[1] is cleared, meaning that the DMA has read that register. Also, a new value appears in variables[0]. But RES[2] and RES[3] both have their valid flags set to 1, i.e. VF = 1, meaning that the DMA has never read those registers.
One more observation that might help - if I remove wait_for_read_mode = 1 from result configuration registers, then DMA seems to work as it should, or at least transfer some values into variables[1] and variables[2]. Can it be that the first block transfer is different from the rest somehow?
Could someone please shed some light on this problem? Cheers!
Best regards,
Andrey
Show Less
I am trying to configure the DMA module to read 3 ADC registers and transfer their contents into an array. It is similar to what is described in the following App. Note: http://www.infineon.com/dgdl/Infineon-GPDMA-XMC4000-AP32290-AN-v01_00-EN.pdf?fileId=5546d4624e765da5014ed9145c601e95, Multi block transfer of VADC result registers to RAM for
motor control.
In short, I configured the ADC to take 8 samples, which are distributed among 3 result registers (accumulation mode is ON). When the last conversion is completed and the result becomes available, an SR trigger is fired (e.g. G0SR1) to indicate the availability of all the results. This trigger is routed to GPDMA0, Channel 0, which is configured as follows:
XMC_DMA_CH_CONFIG_t dma0_config_channel0 = {
.enable_interrupt = false,
.dst_transfer_width = XMC_DMA_CH_TRANSFER_WIDTH_16,
.src_transfer_width = XMC_DMA_CH_TRANSFER_WIDTH_16,
.dst_address_count_mode = XMC_DMA_CH_ADDRESS_COUNT_MODE_INCREMENT,
.src_address_count_mode = XMC_DMA_CH_ADDRESS_COUNT_MODE_INCREMENT,
.dst_burst_length = XMC_DMA_CH_BURST_LENGTH_1, /* TRANSACTION LENGTH - not applicable for memory transfers; memory transfers are limited by AHB transfer size */
.src_burst_length = XMC_DMA_CH_BURST_LENGTH_1,
.enable_dst_scatter = false, /* Target variables are 16 bit */
.enable_src_gather = true, /* To get 16-bit result from 32-bit register */
.src_gather_interval = 1U,
.src_gather_count = 1U,
.dst_scatter_interval = 0U,
.dst_scatter_count = 0U,
.block_size = 3U,
.transfer_flow = XMC_DMA_CH_TRANSFER_FLOW_P2M_DMA,
.src_addr = (uint32_t) &(VADC_G0->RES[1]),
.dst_addr = (uint32_t) &variables[0],
.transfer_type = XMC_DMA_CH_TRANSFER_TYPE_MULTI_BLOCK_SRCADR_RELOAD_DSTADR_RELOAD,
.priority = XMC_DMA_CH_PRIORITY_7,
.src_handshaking = XMC_DMA_CH_SRC_HANDSHAKING_HARDWARE,
.src_peripheral_request = DMA0_PERIPHERAL_REQUEST_VADC_G0SR1_4
};
In my understanding, what would happen is as follows:
(a) The DMA would look at VADC_G0->RES[1] (which it does properly, by the way, but I will elaborate on this a little later), take the value from that register and transfer it to variables[0]
(b) The source address would increment by 32 bits (because of gather settings), and would point at VADC_G0->RES[2]
(c) The destination address would increment by 16 bits and would point to variables[1] (Note: variables is an array of type uint16_t)
(d) This process would repeat, starting from (a), but for VADC_G0->RES[2]
However, the problem is that the DMA stalls once it has transferred the values out of RES[1] to variables[0]. In other words, when I look at the RES
One more observation that might help - if I remove wait_for_read_mode = 1 from result configuration registers, then DMA seems to work as it should, or at least transfer some values into variables[1] and variables[2]. Can it be that the first block transfer is different from the rest somehow?
Could someone please shed some light on this problem? Cheers!
Best regards,
Andrey
XMC™
Hi all,I want to read the register NVIC_ISER to check if an interrupt is enabled or not but I am not sure how to do that. Do I use RD_REG()? If yes, w...
Show More
Hi all,
I want to read the register NVIC_ISER to check if an interrupt is enabled or not but I am not sure how to do that. Do I use RD_REG()? If yes, what should I pass as paramter? NVIC_ISERx?
Thanks,
Ahmed Show Less
I want to read the register NVIC_ISER to check if an interrupt is enabled or not but I am not sure how to do that. Do I use RD_REG()? If yes, what should I pass as paramter? NVIC_ISERx?
Thanks,
Ahmed Show Less
XMC™
I tried to use the Timer Apps to get the current time since the timer is started, but it doesn’t seem working;Look at the following code :Inside the i...
Show More
I tried to use the Timer Apps to get the current time since the timer is started, but it doesn’t seem working;
Look at the following code :
Inside the infinite loop, the value elapsedTime receive the result of TIMER_GetTime(&TIMER_0).
It should increase at each loop right ? However, at the third loop, the value decrease, and increase again.
I configured the App with CCU8, a time interval of 1000 us, and no time interval event.
I don’t need to generate event, but I don’t know how to choose the timer resolution (From 0 to 1 count, the time taken is 1ms for example).
With a time interval of 1000 us, I have the following :
initTime = 119
timerRunning = 1
1. elapsedTime = 62730
2. elapsedTime = 2844
3. elapsedTime = 40827
4. elapsedTime = 41261
5. elapsedTime = 13538
The result should increase at each loop, or it seem random.
Any help please ?
Nicolas Show Less
Look at the following code :
Inside the infinite loop, the value elapsedTime receive the result of TIMER_GetTime(&TIMER_0).
It should increase at each loop right ? However, at the third loop, the value decrease, and increase again.
I configured the App with CCU8, a time interval of 1000 us, and no time interval event.
I don’t need to generate event, but I don’t know how to choose the timer resolution (From 0 to 1 count, the time taken is 1ms for example).
With a time interval of 1000 us, I have the following :
initTime = 119
timerRunning = 1
1. elapsedTime = 62730
2. elapsedTime = 2844
3. elapsedTime = 40827
4. elapsedTime = 41261
5. elapsedTime = 13538
The result should increase at each loop, or it seem random.
int main(void)
{
DAVE_STATUS_t status;
TIMER_STATUS_t timer_status;
uint32_t initTime;
uint32_t elapsedTime;
uint32_t i,j,k = 0;
uint32_t test = 0;
uint8_t timerRunning = 0;
status = DAVE_Init(); /* Initialization of DAVE APPs */
if(status != DAVE_STATUS_SUCCESS)
{
/* Placeholder for error handler code. The while loop below can be replaced with an user error handler. */
XMC_DEBUG("DAVE APPs initialization failed\n");
while(1U)
{
}
}
TIMER_Start(&TIMER_0);
if ( TIMER_GetTimerStatus(&TIMER_0)) // TIMER_GetTimerStatus(&TIMER_0) : return true = timer is running
{
initTime = TIMER_GetTime(&TIMER_0);
timerRunning = 1;
}
/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{
j = 0;
for (i=0; i<365000; i++)
{
j = i+1;
}
j = 0;
elapsedTime = TIMER_GetTime(&TIMER_0);
}
}
Any help please ?
Nicolas Show Less
XMC™
Hi,I have a question for the more xperienced users here; when I use the App USBD_VCOM, does the pin 0.10 get assigned to something? I have a button co...
Show More
Hi,
I have a question for the more xperienced users here; when I use the App USBD_VCOM, does the pin 0.10 get assigned to something? I have a button connected to that pin and set up with an interrupt and when I initialise USBD_VCOM the interrupt stops firing although the signal still stands.
Thanks,
Ahmed Show Less
I have a question for the more xperienced users here; when I use the App USBD_VCOM, does the pin 0.10 get assigned to something? I have a button connected to that pin and set up with an interrupt and when I initialise USBD_VCOM the interrupt stops firing although the signal still stands.
Thanks,
Ahmed Show Less
XMC™
Hello all,
I have a quick questions, what Pin is the signal VAGND assigned to? Or is that connected to GND?
Cheers,
Ahmed
I have a quick questions, what Pin is the signal VAGND assigned to? Or is that connected to GND?
Cheers,
Ahmed
XMC™
Hello,I am using DACWG001 in Singe Value mode to output an analog voltage. However, the DAC is setting crazy voltages:Input | Output0 |...
Show More
Hello,
I am using DACWG001 in Singe Value mode to output an analog voltage. However, the DAC is setting crazy voltages:
Input | Output
0 | 0.3 (correct)
1000 | 1.7 (incorrect)
2000 | 0.8 (incorrect)
2500 | 0.4 (incorrect)
2550 | 2.1 (incorrect)
2600 | 1.7 (correct)
2650 | 1.2 (incorrect)
3000 | 2.2 (incorrect)
4095 | 2.4 (incorrect)
Has anyone else encountered the same problem and know if I'm the one doing something wrong?
EDIT: I have found out what I was doing wrong; in scale I thought 1 means multiplying with 1 but turns out it's 2^1, my bad. While that doesn't explain the weird voltage levels, now that I set it at 0 everythings's fine. Show Less
I am using DACWG001 in Singe Value mode to output an analog voltage. However, the DAC is setting crazy voltages:
Input | Output
0 | 0.3 (correct)
1000 | 1.7 (incorrect)
2000 | 0.8 (incorrect)
2500 | 0.4 (incorrect)
2550 | 2.1 (incorrect)
2600 | 1.7 (correct)
2650 | 1.2 (incorrect)
3000 | 2.2 (incorrect)
4095 | 2.4 (incorrect)
Has anyone else encountered the same problem and know if I'm the one doing something wrong?
EDIT: I have found out what I was doing wrong; in scale I thought 1 means multiplying with 1 but turns out it's 2^1, my bad. While that doesn't explain the weird voltage levels, now that I set it at 0 everythings's fine. Show Less
XMC™
Hello,I'm wondering what the MAC address of my Relax board is.Is it defined in the XMC4500 or in the PHY? Or is there no "official" MAC address, so wh...
Show More
Hello,
I'm wondering what the MAC address of my Relax board is.
Is it defined in the XMC4500 or in the PHY? Or is there no "official" MAC address, so which should I take then?
Thank you in advance.
Best regards
Lonz Show Less
I'm wondering what the MAC address of my Relax board is.
Is it defined in the XMC4500 or in the PHY? Or is there no "official" MAC address, so which should I take then?
Thank you in advance.
Best regards
Lonz Show Less
XMC™
Hi all!I've having an issue with my XMC4500 relex kit and usic channel. Here's my code:volatile uint8_t tx_completion_0 = 0; /* Transmit callback hand...
Show More
Hi all!
I've having an issue with my XMC4500 relex kit and usic channel. Here's my code:
As you can see it's almost a copy from the I2C example, but still doesn't give me any output ( I configured the end of transmit callback to be function tx_callback_0 and the pins to be SCl:0.8 and SDA:1.5)
and in the debugger when I lock at USIC0_C0 address I find all ones
Thanks in advance! Show Less
I've having an issue with my XMC4500 relex kit and usic channel. Here's my code:
volatile uint8_t tx_completion_0 = 0;
/* Transmit callback handling */
void tx_callback_0(void)
{
tx_completion_0 = 1;
}
int main(void)
{
DAVE_STATUS_t status;
uint8_t tr1[7] = { OLED_CONTROL_BYTE_CMD_STREAM, OLED_CMD_SET_COLUMN_RANGE, 0x00, 0x7F, OLED_CMD_SET_PAGE_RANGE,0x00, 0x07 };
status = DAVE_Init(); /* Initialization of DAVE APPs */
XMC_DEBUG("here at least?...")
if(status == DAVE_STATUS_FAILURE)
{
/* Placeholder for error handler code. The while loop below can be replaced with an user error handler. */
XMC_DEBUG("DAVE APPs initialization failed\n");
while(1U)
{
}
}
/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{
I2C_MASTER_Transmit(&I2C_MASTER_0, true, OLED_I2C_ADDRESS, tr1, 7, true );
while(!tx_completion_0);
tx_completion_0 = 0;
for(uint16_t i=0;i<1024;i++){
I2C_MASTER_SendStart(&I2C_MASTER_0, OLED_I2C_ADDRESS, XMC_I2C_CH_CMD_WRITE);
I2C_MASTER_TransmitByte(&I2C_MASTER_0, OLED_CONTROL_BYTE_DATA_STREAM);
while(!tx_completion_0);
tx_completion_0 = 0;
for (uint8_t x=0; x<16; x++) {
I2C_MASTER_TransmitByte(&I2C_MASTER_0, 0x81);
while(!tx_completion_0);
tx_completion_0 = 0;
i++;
}
I2C_MASTER_SendStop(&I2C_MASTER_0);
}
}
}
As you can see it's almost a copy from the I2C example, but still doesn't give me any output ( I configured the end of transmit callback to be function tx_callback_0 and the pins to be SCl:0.8 and SDA:1.5)
and in the debugger when I lock at USIC0_C0 address I find all ones
Thanks in advance! Show Less
XMC™
Hello! I have a doubt, and was wondering if you could help me. I designed a PCB where I place my XMC4500 board. I program the board and then I place i...
Show More
Hello!
I have a doubt, and was wondering if you could help me.
I designed a PCB where I place my XMC4500 board. I program the board and then I place it on the PCB, that feeds power to the XMC and receives the signals for ADCs, PWMs, etc.
I am using xSPY and UART communication to debug my code. I put a stream box in an xSPY window and see if the variables take the correct value for each input. For this, I need to use the debugger and put the XMC in run mode.
This is all working well when I feed the XMC via USB port.
My question is, having my PCB feeding the XMC, can I connect it to a USB port and run the debugger safely, or do I risk burning the XMC and/or my USB port?
Thanks so much and its OK to laugh at the question if it is ridiculous 🙂 Show Less
I have a doubt, and was wondering if you could help me.
I designed a PCB where I place my XMC4500 board. I program the board and then I place it on the PCB, that feeds power to the XMC and receives the signals for ADCs, PWMs, etc.
I am using xSPY and UART communication to debug my code. I put a stream box in an xSPY window and see if the variables take the correct value for each input. For this, I need to use the debugger and put the XMC in run mode.
This is all working well when I feed the XMC via USB port.
My question is, having my PCB feeding the XMC, can I connect it to a USB port and run the debugger safely, or do I risk burning the XMC and/or my USB port?
Thanks so much and its OK to laugh at the question if it is ridiculous 🙂 Show Less
XMC™
Hi,I am evaluating the maximum speed which could be achieved by the XMC4800 on the Relax Kit v1.I am using a self implemented bare bone UDP packet bui...
Show More
Hi,
I am evaluating the maximum speed which could be achieved by the XMC4800 on the Relax Kit v1.
I am using a self implemented bare bone UDP packet builder and the function XMC_ETH_MAC_SendFrame() from XMCLib.
Latest DAVE 4.1.x with latest XMCLibs. uC set on 144 Mhz and ETH-PHY and ETH configured and setup as in the demo "XMC4700/XMC4800 Web Server Demo including MicroSD card access".
Forcing to 10 Mbit/s on each side I get a little bit over 1 MebiByte/s as transfer rate with a 1024 byte UDP payload. This is saturated.
Measured via PC on Windows with Wireshark with an Intel Pro 1 GBit/s NIC.
Using auto negotiaton I get 100 Mbit/s on each side as expected.
Now I get 6,72 MebiByte/s as transfer rate with a 1024 byte UDP payload. Transfer lasts ~1,5 s for 10 MebiByte.
This is not even close to saturation which should be around 11 MebiByte/s.
This is the main loop on sending.
packetCount is 10 * 1024 and frameLen is 1066 (1024 UDP payload + 42 bytes header).
ETH_SendFrame() returns with 1 after 4 TX frames, which is expected, since the TX buffer size is 4. It gets 0 as soon as new data could be put into the buffers.
Raising the buffer size does not speed up. Also using the optimizer does not help. But as one could see by the return of 1 of ETH_SendFrame() there is no prozessor bottleneck.
Is this what i should expect? Only 60% maximum speed on 100 MBit/s?
Thanks for help. Show Less
I am evaluating the maximum speed which could be achieved by the XMC4800 on the Relax Kit v1.
I am using a self implemented bare bone UDP packet builder and the function XMC_ETH_MAC_SendFrame() from XMCLib.
Latest DAVE 4.1.x with latest XMCLibs. uC set on 144 Mhz and ETH-PHY and ETH configured and setup as in the demo "XMC4700/XMC4800 Web Server Demo including MicroSD card access".
Forcing to 10 Mbit/s on each side I get a little bit over 1 MebiByte/s as transfer rate with a 1024 byte UDP payload. This is saturated.
Measured via PC on Windows with Wireshark with an Intel Pro 1 GBit/s NIC.
Using auto negotiaton I get 100 Mbit/s on each side as expected.
Now I get 6,72 MebiByte/s as transfer rate with a 1024 byte UDP payload. Transfer lasts ~1,5 s for 10 MebiByte.
This is not even close to saturation which should be around 11 MebiByte/s.
This is the main loop on sending.
for (uint16_t i = 0; i < packetCount; i++) {
while (ETH_SendFrame((uint8_t*) &udpIp4Packet, frameLen))
;
}
packetCount is 10 * 1024 and frameLen is 1066 (1024 UDP payload + 42 bytes header).
ETH_SendFrame() returns with 1 after 4 TX frames, which is expected, since the TX buffer size is 4. It gets 0 as soon as new data could be put into the buffers.
Raising the buffer size does not speed up. Also using the optimizer does not help. But as one could see by the return of 1 of ETH_SendFrame() there is no prozessor bottleneck.
Is this what i should expect? Only 60% maximum speed on 100 MBit/s?
Thanks for help. Show Less