XMC™ Forum Discussions
XMC™
Hello,I try to access a nfc (near field communication) reader via I2C using a xmc4200 and the xmc peripheral library. As there is very little document...
Show More
Hello,
I try to access a nfc (near field communication) reader via I2C using a xmc4200 and the xmc peripheral library. As there is very little documentation (or I was not able to find it) for the xmc i2c library part, I've picked the example, that was shipped with the xmc peripheral library. In a small example, I want to see that I'm able to write 10 bytes to a fifo (first in first out) within the nfc reader and after this, reading back the fifo content.
I've learned that I have to use XMC_I2C_CH_MasterReceiveAck() to indicate that I'm going to read data from the bus and acknowledge that data for all, but the first byte. For the last byte I have to send a Nack using XMC_I2C_CH_MasterReceiveNack(). For every byte to be received, I should be able to poll the protocol status register for XMC_I2C_CH_STATUS_FLAG_RECEIVE_INDICATION or XMC_I2C_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION and seeing one of the flags would indicate that a new byte is ready in RBUF to be read:
The code above works well, when stepping through it, using a debugger. But if I'm setting a breakpoint behind the loop, I see that some (3) values at the beginning are repeated. If I write for example [ 0xff, 0x00, 0xaa, 1, 2 , 3 , 4 , 5, 6, 7 ] to the fifo, I read back [ 0xff, 0xff, 0xff, 0x00, 0xaa, 1, 2, 3 ...]. By using an oscilloscope, I can tell that the data on the bus was right in such cases. So to me, it looks like, I'm reading to much data from one event and there must be some other flags that must be checked too.
Does someone of you have used this API and knows how to use it? Neither the search function of this forum, nor google reveals any results to a search for "XMC_I2C_CH_GetReceivedData()".
Kind regards,
Torsten Show Less
I try to access a nfc (near field communication) reader via I2C using a xmc4200 and the xmc peripheral library. As there is very little documentation (or I was not able to find it) for the xmc i2c library part, I've picked the example, that was shipped with the xmc peripheral library. In a small example, I want to see that I'm able to write 10 bytes to a fifo (first in first out) within the nfc reader and after this, reading back the fifo content.
I've learned that I have to use XMC_I2C_CH_MasterReceiveAck() to indicate that I'm going to read data from the bus and acknowledge that data for all, but the first byte. For the last byte I have to send a Nack using XMC_I2C_CH_MasterReceiveNack(). For every byte to be received, I should be able to poll the protocol status register for XMC_I2C_CH_STATUS_FLAG_RECEIVE_INDICATION or XMC_I2C_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION and seeing one of the flags would indicate that a new byte is ready in RBUF to be read:
static void receive( std::uint8_t* buffer, std::size_t buffer_size )
{
for ( ; buffer_size; --buffer_size, ++buffer )
{
if ( buffer_size == 1 )
{
XMC_I2C_CH_MasterReceiveNack(channel);
}
else
{
XMC_I2C_CH_MasterReceiveAck(channel);
}
while( ( XMC_I2C_CH_GetStatusFlag( channel )
& ( XMC_I2C_CH_STATUS_FLAG_RECEIVE_INDICATION | XMC_I2C_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION ) ) == 0U )
{
/* wait for ACK */
}
XMC_I2C_CH_ClearStatusFlag(XMC_I2C1_CH0, XMC_I2C_CH_STATUS_FLAG_RECEIVE_INDICATION |
XMC_I2C_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION);
*buffer = XMC_I2C_CH_GetReceivedData(channel);
}
}
The code above works well, when stepping through it, using a debugger. But if I'm setting a breakpoint behind the loop, I see that some (3) values at the beginning are repeated. If I write for example [ 0xff, 0x00, 0xaa, 1, 2 , 3 , 4 , 5, 6, 7 ] to the fifo, I read back [ 0xff, 0xff, 0xff, 0x00, 0xaa, 1, 2, 3 ...]. By using an oscilloscope, I can tell that the data on the bus was right in such cases. So to me, it looks like, I'm reading to much data from one event and there must be some other flags that must be checked too.
Does someone of you have used this API and knows how to use it? Neither the search function of this forum, nor google reveals any results to a search for "XMC_I2C_CH_GetReceivedData()".
Kind regards,
Torsten Show Less
XMC™
Hi,I've created a simple PWM app with my DAVE4 and the app is working on my eval board (XMC1100 boot kit). When I debug the program I can't find how t...
Show More
Hi,
I've created a simple PWM app with my DAVE4 and the app is working on my eval board (XMC1100 boot kit).
When I debug the program I can't find how the output pin assigned to CCU4.
I've seen some register settings while debugging which are set up the PWM modul.
I've also seen that the output pin configured. (previously I have changed the PinMapping)
But how the CCU4 modul know which output pin have to drive? For example how CCU4 know that it should drive P1.3? Show Less
I've created a simple PWM app with my DAVE4 and the app is working on my eval board (XMC1100 boot kit).
When I debug the program I can't find how the output pin assigned to CCU4.
I've seen some register settings while debugging which are set up the PWM modul.
I've also seen that the output pin configured. (previously I have changed the PinMapping)
But how the CCU4 modul know which output pin have to drive? For example how CCU4 know that it should drive P1.3? Show Less
XMC™
Hi,I'm using the UART App of DAVE 4 in half duplex configuration with a XMC4500. The UART is connected to a RS485-Transceiver and the XMC4500 tells th...
Show More
Hi,
I'm using the UART App of DAVE 4 in half duplex configuration with a XMC4500. The UART is connected to a RS485-Transceiver and the XMC4500 tells the transceiver via a GPIO if it should transmit or receive data. If I want to transmit data the GPIO will be set to low so the transceiver is in it's transmit state. Now I need to know the correct time to set the GPIO high again, which is when all bytes have been transmitted (including stop bits and possible parity bits). However, the "End of transmit callback" which can be configured in the UART-App doesn't give me the correct timing since it is called when the last byte of the transmit data has been transferred to the shift register. What I need is a callback-function that is called when the "Frame Finished Interrupt" occured. As far as I remember Dave 3 used that Interrupt for it's callback, so is it possible that this interrupt will be also available when DAVE 4 gets out of it's beta stage?
For now I configured the "Frame Finished Interrupt" manually (using XMCLib-functions) and an Interrupt Output Line not used by the DAVE-App. However, this is not a long-lasting solution since I will, at some point, use both channels of an USIC-module. All Interrupt-Output-Lines are used by the DAVE-App then.
Thanks,
Niclas Show Less
I'm using the UART App of DAVE 4 in half duplex configuration with a XMC4500. The UART is connected to a RS485-Transceiver and the XMC4500 tells the transceiver via a GPIO if it should transmit or receive data. If I want to transmit data the GPIO will be set to low so the transceiver is in it's transmit state. Now I need to know the correct time to set the GPIO high again, which is when all bytes have been transmitted (including stop bits and possible parity bits). However, the "End of transmit callback" which can be configured in the UART-App doesn't give me the correct timing since it is called when the last byte of the transmit data has been transferred to the shift register. What I need is a callback-function that is called when the "Frame Finished Interrupt" occured. As far as I remember Dave 3 used that Interrupt for it's callback, so is it possible that this interrupt will be also available when DAVE 4 gets out of it's beta stage?
For now I configured the "Frame Finished Interrupt" manually (using XMCLib-functions) and an Interrupt Output Line not used by the DAVE-App. However, this is not a long-lasting solution since I will, at some point, use both channels of an USIC-module. All Interrupt-Output-Lines are used by the DAVE-App then.
Thanks,
Niclas Show Less
XMC™
Hi,What is wrong with this code?When I debug it in DAVE4 with XMC1100 Boot Kit the SHPR2 register not changing in the debugger.The code is based on Ea...
Show More
Hi,
What is wrong with this code?
When I debug it in DAVE4 with XMC1100 Boot Kit the SHPR2 register not changing in the debugger.
The code is based on EasyMain (LED blinking is working for example with a modified main)
What is wrong with this code?
When I debug it in DAVE4 with XMC1100 Boot Kit the SHPR2 register not changing in the debugger.
The code is based on EasyMain (LED blinking is working for example with a modified main)
Show Less
#include "XMC1100.h"
int main(void)
{
unsigned int a;
a = 0x0B << PPB_SHPR2_PRI_11_Pos;
PPB->SHPR2 |= a;
while(1);
}
XMC™
Hello,In XMC1302, uC locks up whenever there is a hardfault.I want to ensure that in a mission critical application, hardfault is handled properly ins...
Show More
Hello,
In XMC1302, uC locks up whenever there is a hardfault.
I want to ensure that in a mission critical application, hardfault is handled properly instead of going into lockup.
Are there any code templates for hardfault?
If I want to reset the uC in case of hardfault, where should the code be placed?
Although , a hardfault does not occur in normal operation, corrupt e2prom data caused a lockup in one instance.
Thanks Show Less
In XMC1302, uC locks up whenever there is a hardfault.
I want to ensure that in a mission critical application, hardfault is handled properly instead of going into lockup.
Are there any code templates for hardfault?
If I want to reset the uC in case of hardfault, where should the code be placed?
Although , a hardfault does not occur in normal operation, corrupt e2prom data caused a lockup in one instance.
Thanks Show Less
XMC™
Hi there,I want to concatinate Timers on the XMC1100. According to the XMC1100 reference manual page 595 CC4yTC.TCE needs to be set to 1. However, loo...
Show More
Hi there,
I want to concatinate Timers on the XMC1100. According to the XMC1100 reference manual page 595 CC4yTC.TCE needs to be set to 1. However, looking at the register CC4yTC page 656 (16-108) I can not find that field.
I could, however, find a 'TCE' in in the CC4yCMC Connection Matrix Control. Would this provide the right setting?
thanks in advance for somebodys advice. Show Less
I want to concatinate Timers on the XMC1100. According to the XMC1100 reference manual page 595 CC4yTC.TCE needs to be set to 1. However, looking at the register CC4yTC page 656 (16-108) I can not find that field.
I could, however, find a 'TCE' in in the CC4yCMC Connection Matrix Control. Would this provide the right setting?
thanks in advance for somebodys advice. Show Less
XMC™
Hallo,In my project I collect data and need to store it untill I send it via UART to my PC. UART works with DAVE apps.But I have problems with the siz...
Show More
Hallo,
In my project I collect data and need to store it untill I send it via UART to my PC. UART works with DAVE apps.
But I have problems with the size of the array.
I tried to do this with a simple array of int32_t. It should have about 2000 elements. The XMC4500 on the Relax Lite Kit has a flash of 1MB and a RAM of 160KB.
I tried it simply with:
int32_t I1_val[SIZE]={0};
This works only up to a size of 460 elements. For higher elements the xmc stops at startup at: Insert ExceptionHandler HardFault_Handler
Splitting up the array into different variables doesnt make any difference, so I figured its an memory size problem.
How can I place the array on the RAM ?
Hope somebody finds the time to explain this probably simple problem to me.
Thanks
Georg Show Less
In my project I collect data and need to store it untill I send it via UART to my PC. UART works with DAVE apps.
But I have problems with the size of the array.
I tried to do this with a simple array of int32_t. It should have about 2000 elements. The XMC4500 on the Relax Lite Kit has a flash of 1MB and a RAM of 160KB.
I tried it simply with:
int32_t I1_val[SIZE]={0};
This works only up to a size of 460 elements. For higher elements the xmc stops at startup at: Insert ExceptionHandler HardFault_Handler
Splitting up the array into different variables doesnt make any difference, so I figured its an memory size problem.
How can I place the array on the RAM ?
Hope somebody finds the time to explain this probably simple problem to me.
Thanks
Georg Show Less
XMC™
I had an XMC4500 relax lite kit receiving data by SPI, and responding to a Windows script via USB. This has been working for days. This morning, the W...
Show More
I had an XMC4500 relax lite kit receiving data by SPI, and responding to a Windows script via USB. This has been working for days. This morning, the Windows USB script wasn't able to get the requested information from the relax kit and the SPI master (Aardvark) wasn't working properly anymore. So I tried to reload the latest version of my code to the XMC and get :
"Exception occured during launch
Reason : Error creating session
Can not connect to J-Link via USB"
My communication scripts and the relax kit board have been working for days, and it has crashed today. Anyone ever experienced this ? What could have happened and what could I do to get my relax kit back on track ?
Thanks in advance. Show Less
"Exception occured during launch
Reason : Error creating session
Can not connect to J-Link via USB"
My communication scripts and the relax kit board have been working for days, and it has crashed today. Anyone ever experienced this ? What could have happened and what could I do to get my relax kit back on track ?
Thanks in advance. Show Less
XMC™
Industrial Automation - Dual FOC Motor Control demoHave a closer look to our motor control demo showing the capabilities of the XMC4400 device. The XM...
Show More
Industrial Automation - Dual FOC Motor Control demo
Have a closer look to our motor control demo showing the capabilities of the XMC4400 device. The XMC4400 is a member of Infineon´s Cortex M4 based microcontrollers. We are showing a setup called "Controller based Motion". A PLC controls several motion axis and the Drive executes the motion commands. This is commonly used in automation industry.
Click on image to view video, or go to: http://bit.ly/Dual_FOC_Motor_Control Show Less
Have a closer look to our motor control demo showing the capabilities of the XMC4400 device. The XMC4400 is a member of Infineon´s Cortex M4 based microcontrollers. We are showing a setup called "Controller based Motion". A PLC controls several motion axis and the Drive executes the motion commands. This is commonly used in automation industry.
Click on image to view video, or go to: http://bit.ly/Dual_FOC_Motor_Control Show Less
XMC™
Hello,After transferring 8 16byte packets I am getting AHB error interrupt on OUT endpoint when developing USB device application. When trying to unde...
Show More
Hello,
After transferring 8 16byte packets I am getting AHB error interrupt on OUT endpoint when developing USB device application. When trying to understand what is happening, I get strange values in folowing registers:
DOEPDMA=0x00870004
DOEPDMAB=0x66656463
DOEPDMA should be pointing in RAM?
Can someone help me? How to avoid AHB errors and how to handle them.
Thanks
rum Show Less
After transferring 8 16byte packets I am getting AHB error interrupt on OUT endpoint when developing USB device application. When trying to understand what is happening, I get strange values in folowing registers:
DOEPDMA=0x00870004
DOEPDMAB=0x66656463
DOEPDMA should be pointing in RAM?
Can someone help me? How to avoid AHB errors and how to handle them.
Thanks
rum Show Less