XMC™ Forum Discussions
XMC™
Hi there,I am trying to read a one wire device using a UART to 1-wire adapter with an XMC4800 as the microcontroller. While I can read much of the inf...
Show More
Hi there,
I am trying to read a one wire device using a UART to 1-wire adapter with an XMC4800 as the microcontroller. While I can read much of the information coming back from the UART-to-1-Wire device, I am having a lot of trouble reading the specific aspects I want.
For instance there are many native 1 wire commands such as SKIP-ROM, MATCH-ROM etc. Individual chips then have their own specific commands for performing functions they are defined for.
Using the current method, I have to send both types of commands (native 1-Wire and the chip's specific commands) using the UART app with DAVE. The UART adapter chip will convert the UART signal to a 1-Wire signal and return any data to the XMC which the 1-wire chip has sent back.
I'm analysing these signals with an external signal reader and can see that all the bytes have the correct values. The issue lies with my implementation of the Dave UART app, in that often it will send back old bytes which I do not need nor want to read.
For example, it will send back the return bytes from some of the Native 1-wire commands, which I actually don't need to read at the point time. Meanwhile, it is as if these data bytes are stored so that later when I attempt to read back more important data, these bytes will be forced into the array I have created for the important information.
Is there a FIFO register which is being filled up with this information, eventhough I'm not asking for the information to be read programmatically? Is there a way to clear this register, so that when I want to start reading information I will immediatley get the most recent data bytes instead of ones that were sent ages ago?
UART Settings:
Full duplex mode
Transmit mode: interrupt
Receive mode: interrupt
Enable receive FIFO, size 64
Dave function I'm using to receive data:
read_data_response =(uint8_t)XMC_UART_CH_GetReceivedData(UART_0.channel);
I'm sorry for the long-winded explanation. I hope it was clear enough to understand with enough information that clears explains the issue I'm having with the UART App. Any help with this matter would be much appreciated. Show Less
I am trying to read a one wire device using a UART to 1-wire adapter with an XMC4800 as the microcontroller. While I can read much of the information coming back from the UART-to-1-Wire device, I am having a lot of trouble reading the specific aspects I want.
For instance there are many native 1 wire commands such as SKIP-ROM, MATCH-ROM etc. Individual chips then have their own specific commands for performing functions they are defined for.
Using the current method, I have to send both types of commands (native 1-Wire and the chip's specific commands) using the UART app with DAVE. The UART adapter chip will convert the UART signal to a 1-Wire signal and return any data to the XMC which the 1-wire chip has sent back.
I'm analysing these signals with an external signal reader and can see that all the bytes have the correct values. The issue lies with my implementation of the Dave UART app, in that often it will send back old bytes which I do not need nor want to read.
For example, it will send back the return bytes from some of the Native 1-wire commands, which I actually don't need to read at the point time. Meanwhile, it is as if these data bytes are stored so that later when I attempt to read back more important data, these bytes will be forced into the array I have created for the important information.
Is there a FIFO register which is being filled up with this information, eventhough I'm not asking for the information to be read programmatically? Is there a way to clear this register, so that when I want to start reading information I will immediatley get the most recent data bytes instead of ones that were sent ages ago?
UART Settings:
Full duplex mode
Transmit mode: interrupt
Receive mode: interrupt
Enable receive FIFO, size 64
Dave function I'm using to receive data:
read_data_response =(uint8_t)XMC_UART_CH_GetReceivedData(UART_0.channel);
I'm sorry for the long-winded explanation. I hope it was clear enough to understand with enough information that clears explains the issue I'm having with the UART App. Any help with this matter would be much appreciated. Show Less
XMC™
Hi,I'm implement an opc ua server on the xmc4800 automation board. I've tried to use the Matrikon SDK, but now i'm trying with the open62541 https://github.com/open62541/open62541...
Show More
Hi,
I'm implement an opc ua server on the xmc4800 automation board. I've tried to use the Matrikon SDK, but now i'm trying with the open62541 https://github.com/open62541/open62541.
I've followed the instructions for the LWIP implementation, that include adding the following defines to the lwipopts.h file
the NO_SYS define is set to 1.
When I compile I get this error from the lwip library init.c file
I need to use socket and I have to set NO_SYS = 1, so i don't know what to do.
Do anyone has suggestions?
Thank you Show Less
I'm implement an opc ua server on the xmc4800 automation board. I've tried to use the Matrikon SDK, but now i'm trying with the open62541 https://github.com/open62541/open62541.
I've followed the instructions for the LWIP implementation, that include adding the following defines to the lwipopts.h file
#define LWIP_COMPAT_SOCKETS 0
#define LWIP_SOCKET 1
#define LWIP_DNS 0
#define SO_REUSE 1
#define LWIP_TIMEVAL_PRIVATE 1
the NO_SYS define is set to 1.
When I compile I get this error from the lwip library init.c file
#if ((LWIP_SOCKET || LWIP_NETCONN) && (NO_SYS==1))
#error "If you want to use Sequential API, you have to define NO_SYS=0 in your lwipopts.h"
#endif
I need to use socket and I have to set NO_SYS = 1, so i don't know what to do.
Do anyone has suggestions?
Thank you Show Less
XMC™
Hi,We are using XMC4800_relax_kit to read the data from Allen Bradley Micro820 PLC which collects the data from sensors and stores in to holding regis...
Show More
Hi,
We are using XMC4800_relax_kit to read the data from Allen Bradley Micro820 PLC which collects the data from sensors and stores in to holding registers and coils, we are able to read the data from PLC over Modbus, But if i want to read the data from PLC over Ethernet MAC how to read.
Allen Bradley Micro820 PLC supports Modbus and Ethernet IP.
Is there any example? if it is there please let me know.
Thanks & Regards,
Swamy. Show Less
We are using XMC4800_relax_kit to read the data from Allen Bradley Micro820 PLC which collects the data from sensors and stores in to holding registers and coils, we are able to read the data from PLC over Modbus, But if i want to read the data from PLC over Ethernet MAC how to read.
Allen Bradley Micro820 PLC supports Modbus and Ethernet IP.
Is there any example? if it is there please let me know.
Thanks & Regards,
Swamy. Show Less
XMC™
Hi,I am using XMC1400 CPU card and trying to implement CAN. I got 2 ways to implement it as describe in book kit.1) Using DAVE App:I am using DAVE wit...
Show More
Hi,
I am using XMC1400 CPU card and trying to implement CAN. I got 2 ways to implement it as describe in book kit.
1) Using DAVE App:
I am using DAVE with version 4.4.2. I tried exact same way as discussed in book kit but still I am not able to transmit any messages.
2) Using simple project.
I was trying to configure the CAN node using the function XMC_CAN_Init, but I got into indefinite wait time in this function.
Can anyone suggest me the correct process to configure the CAN Node without using the App.
I am also confused about the Global CAN configuration and CAN Node configuration.
As when using App we are configuring both, but when we are not using APP, whether we need to configure both or not.
Can anyone make me clear the difference between the two?
Thanks,
Kaushlendra Show Less
I am using XMC1400 CPU card and trying to implement CAN. I got 2 ways to implement it as describe in book kit.
1) Using DAVE App:
I am using DAVE with version 4.4.2. I tried exact same way as discussed in book kit but still I am not able to transmit any messages.
2) Using simple project.
I was trying to configure the CAN node using the function XMC_CAN_Init, but I got into indefinite wait time in this function.
Can anyone suggest me the correct process to configure the CAN Node without using the App.
I am also confused about the Global CAN configuration and CAN Node configuration.
As when using App we are configuring both, but when we are not using APP, whether we need to configure both or not.
Can anyone make me clear the difference between the two?
Thanks,
Kaushlendra Show Less
XMC™
Hello!!!I'm using Infineon XMC4200 to generate in a certain output port , for example Port2 , 8 contemporary bit frames that have to be repeated cycli...
Show More
Hello!!!
I'm using Infineon XMC4200 to generate in a certain output port , for example Port2 , 8 contemporary bit frames that have to be repeated cyclically for example every 1 sec.
Every bit frame is composed by 8 bits and the bit timing has to be 20usec; therefore the transmission of the frame lasts 20usec x 8 =160 usec
Considering that :
Frame0 is the frame in the output P2.0 and its value is 0x00,
Frame1 is the frame in the output P2.1 and its value is 0x01,
and so on until Frame7 for output P2.7 value 0x07,
we would obtain in the port2 the following signals that have to be repeated cyclically every 1 sec:
How this can be achieved using an HW peripheral of the XMC4200 ?
(Value reported for the bit frames are just an example).
Thank you in advance for the help
Enzo Show Less
I'm using Infineon XMC4200 to generate in a certain output port , for example Port2 , 8 contemporary bit frames that have to be repeated cyclically for example every 1 sec.
Every bit frame is composed by 8 bits and the bit timing has to be 20usec; therefore the transmission of the frame lasts 20usec x 8 =160 usec
Considering that :
Frame0 is the frame in the output P2.0 and its value is 0x00,
Frame1 is the frame in the output P2.1 and its value is 0x01,
and so on until Frame7 for output P2.7 value 0x07,
we would obtain in the port2 the following signals that have to be repeated cyclically every 1 sec:
How this can be achieved using an HW peripheral of the XMC4200 ?
(Value reported for the bit frames are just an example).
Thank you in advance for the help
Enzo Show Less
XMC™
I have a project with USB. My program transmits a stream of isochronous frames to the host. Frames length == 1023 bytes.In "Slave mode" of USB (GAHBCF...
Show More
I have a project with USB. My program transmits a stream of isochronous frames to the host. Frames length == 1023 bytes.
In "Slave mode" of USB (GAHBCFG.DMAEn=0), everything works fine.
But in "DMA mode" (GAHBCFG.DMAEn=1), at begin of transmission, only one short frame (171-172 bytes length) is transmitted (and was received at host's side). Then data transfer to FIFO stopped and host after that receives only zero length frames.
In errata sheet for this MK (Rel. 1.5, 2018-07), I found a issue "USB_CM.005 DMA support for USB host mode operation". There it is advised not to use DMA. But there we are talking about USB-host. But I have USB-device.
Does this advice apply also to USB-device or not?
PS: Revision of my chip is "AC".
PPS: When transfer to FIFO is stopped, contents of USB registers:
GAHBCFG = 0x1A1
DIEPCTL1 = 0x804483FF
DIEPINT1 = 0x2010
DIEPTSIZ1 = 0x803FF
DIEPDMA1 = 0x20003F54
DTXFSTS1 = 0x2C
DIEPDMAB1 = 0x20003F54 Show Less
In "Slave mode" of USB (GAHBCFG.DMAEn=0), everything works fine.
But in "DMA mode" (GAHBCFG.DMAEn=1), at begin of transmission, only one short frame (171-172 bytes length) is transmitted (and was received at host's side). Then data transfer to FIFO stopped and host after that receives only zero length frames.
In errata sheet for this MK (Rel. 1.5, 2018-07), I found a issue "USB_CM.005 DMA support for USB host mode operation". There it is advised not to use DMA. But there we are talking about USB-host. But I have USB-device.
Does this advice apply also to USB-device or not?
PS: Revision of my chip is "AC".
PPS: When transfer to FIFO is stopped, contents of USB registers:
GAHBCFG = 0x1A1
DIEPCTL1 = 0x804483FF
DIEPINT1 = 0x2010
DIEPTSIZ1 = 0x803FF
DIEPDMA1 = 0x20003F54
DTXFSTS1 = 0x2C
DIEPDMAB1 = 0x20003F54 Show Less
XMC™
Hello,I am using XMC4800 for an EtherCAT slave module. Although we can update firmware via ASC Bootloader using Infineon's memtool, our users want to ...
Show More
Hello,
I am using XMC4800 for an EtherCAT slave module. Although we can update firmware via ASC Bootloader using Infineon's memtool, our users want to update firmware via EtherCAT FoE or, at least, USB device port. Is there any available FoE or USB solution?
I found that Infineon has an application note "Firmware update via SD card" (for XMC4500), where can I download the example code for this AN? I think I can modify this example for FoE, USB updating.
Thank you Show Less
I am using XMC4800 for an EtherCAT slave module. Although we can update firmware via ASC Bootloader using Infineon's memtool, our users want to update firmware via EtherCAT FoE or, at least, USB device port. Is there any available FoE or USB solution?
I found that Infineon has an application note "Firmware update via SD card" (for XMC4500), where can I download the example code for this AN? I think I can modify this example for FoE, USB updating.
Thank you Show Less
XMC™
Hello,to improve the performance of my application on a XMC4500F100K1024AC, I tried to use the CCM but I did't find any hints in the web.In the STM32F...
Show More
Hello,
to improve the performance of my application on a
XMC4500F100K1024AC, I tried to use the CCM but I
did't find any hints in the web.
In the STM32F4xx-world they use a special variable
declaration to place them into the CCM.
So I started to declare my variables step by step
in this way, e. g.:
static float xyz __attribute__((section(".ccmram")));
DAVE's compiler/linker passed without trouble
and there was an ascertainable gain of performance.
But if I exceed a certain number of variables declared
in this way, the application suddenly crashes.
Does the CCM have to be specially initialized or
are other preparations required?
Best regards Show Less
to improve the performance of my application on a
XMC4500F100K1024AC, I tried to use the CCM but I
did't find any hints in the web.
In the STM32F4xx-world they use a special variable
declaration to place them into the CCM.
So I started to declare my variables step by step
in this way, e. g.:
static float xyz __attribute__((section(".ccmram")));
DAVE's compiler/linker passed without trouble
and there was an ascertainable gain of performance.
But if I exceed a certain number of variables declared
in this way, the application suddenly crashes.
Does the CCM have to be specially initialized or
are other preparations required?
Best regards Show Less
XMC™
I need a fast real-time data stream from device (USB-device) to PC (USB-host). I use a large isochronous endpoint (packet length <= 1023 bytes).The da...
Show More
I need a fast real-time data stream from device (USB-device) to PC (USB-host). I use a large isochronous endpoint (packet length <= 1023 bytes).
The data is transmitted, but very often in frame stream on the host side I get of zero-length packets (ZLP). Although I do not send ZLP from my device (I send all packets of a fixed length).
Because of this, the flow rate decreases.
How to transfer data into USB-core so that ZLP-s are absent?
I write the data for transfer like this:
When data transfer to USB-host is completed, an interrupt occurs, which is processed by this code:
remark:
The data is transmitted, but very often in frame stream on the host side I get of zero-length packets (ZLP). Although I do not send ZLP from my device (I send all packets of a fixed length).
Because of this, the flow rate decreases.
How to transfer data into USB-core so that ZLP-s are absent?
I write the data for transfer like this:
#define USBCFG_DMA 0
#define B0 (1u << 0)
#define B1 (1u << 1)
#define B2 (1u << 2)
...
#define B31 (1u << 31)
//Writes number of bytes in to the USB IN endpoint.
u32 UsbHwEpWrite(uint epa, void const *buf, u32 len)
{
UsbEp *ep = &udev.ep[epa & USB_EP_NUM_MSK];
if (ep->state != ep->S_CFG) return 0;
ep->xferBuf = (u8 *)buf;
ep->xferTotal = len;
ep->xferLen = ep->xferCnt = 0;
ep->state = ep->S_IN;
StartWriteXfer(ep);
return ep->xferTotal;
}
//Start a new in transfer.
//Based on the transfer values of the endpoint the in endpoint registers will be programmed to start a new in transfer
//ep - Endpoint to start the transfer
static void StartWriteXfer(UsbEp *ep)
{
uint i, n, e = ep->address & USB_EP_NUM_MSK; //for isoc.ep ep->address == 0x81
HwRegsUSB::T_DEP volatile *pdep = &USB.DIEP;
n = maxTransferSize[__USAT(e, 1)]; //for isoc.ep n == 65472
if (ep->xferTotal - (i = ep->xferLen) < n) ep->xferLen = i = ep->xferTotal;
else ep->xferLen = i += n;
u32 j = 1 << 19; //number of packets. do not used, since i != 0 for isoc.ep
if (i) {
i -= ep->xferCnt;
if (e) j = divCeil(i, ep->maxPacketSize) << 19; //#define divCeil(a, b) (((a) + (b) - 1) / (b))
j |= i; //for isoc.ep for example: j == 0x803FF
if (USBCFG_DMA) { //USBCFG_DMA==0
u8 *s = ep->xferBuf + ep->xferCnt; //source address
if (((u32)s & 3) || !IN_RANGE((u32)s, RAM_regionB_start, RAM_regionC_start + RAM_regionC_size - 1)) { //do not used, since the isochronous point data placed is in RAM
memcpy(ep0buf.data, s, i);
s = ep0buf.data;
}
pdep->DMA = (u32)s; //USB.DIEPDMAx
} else USB.DIEPEMPMSK |= 1 << e; //enable fifo empty interrupt
}
//Program size of transfer and enable endpoint
pdep->TSIZ = j; //USB.DIEPTSIZx
pdep->CTL |= B26 | B31; //USB.DIEPCTLx. set bits CNAK and EPEna
}
When data transfer to USB-host is completed, an interrupt occurs, which is processed by this code:
//Handles all interrupts for all in endpoints
//The interrupt handler first checks, which endpoint has caused the interrupt and then
//determines, which interrupt should be handled.
static void HndIEPInt()
{
int i, e;
u32 c, ie, ia = USB.DAINT & B16 - 1;
while ((e = 31 - __CLZ(ia)) >= 0) {
ia -= 1 << e;
UsbEp *ep = &udev.ep;
HwRegsUSB::T_DEP volatile *pdep = &USB.DIEP;
ie = pdep->INT; //USB.DIEPINTx
ie &= (USB.DIEPEMPMSK >> e & 1) << 7 | DIEPMSK; //enum {DIEPMSK = B0 | B1 | B2 | B3};
if (!USBCFG_DMA) if (ie & B7) {
//Write data to an endpoint fifo
//The data from the ep->xferBuf gets copied in to the tx fifo of the endpoint until the buffer has been read
//completely or the tx fifo is full. The transfer values are not updated.
if (c = ep->xferLen - ep->xferCnt) { //calculate the length and the amount of dwords to copy based on the fifo status
//add the unaligned bytes to the word count to compare with the fifo space
if (c < (i = (pdep->TXFSTS & B16 - 1) << 2)) i = c; //pdep->TXFSTS == USB.DTXFSTSx
u32 volatile *fifo = FIFO_PTR(ep->txFifoNum); //#define FIFO_PTR(epn) (u32 *)((u8 *)&USB + 0x1000 + (uint)(epn) * 0x1000)
u8 *s = ep->xferBuf + (c = ep->xferCnt);
for (ep->xferCnt = c + i; (i -= 4) >= 0; s += 4) *fifo = *(u32p8 *)s; //copy data dword wise
if (i & 3) {
c = 0;
if ((i += 2) >= 0) {
c = *(u16p8 *)s;
s += 2;
}
if (i) c |= *s++ << __USAT(i << 4, 5);
*fifo = c;
}
}
}
if (ie & B0) {
if (USBCFG_DMA) if (!(pdep->TSIZ & B29 - 1)) ep->xferCnt = ep->xferLen; //pdep->TSIZ == USB.DIEPTSIZx
if (ep->xferTotal == ep->xferLen) { //always true
pdep->CTL = pdep->CTL & (B11 - 1 | B15 | 3 << 18 | B20 | 15 << 22) | B27; //USB.DIEPCTLx. set bit SNAK. I also tried not to set this bit after transfer was completed - but nothing changes
ep->state = ep->S_CFG;
if (!USBCFG_DMA) USB.DIEPEMPMSK &= ~(1 << e); //Mask fifo empty interrupt
UsbEventEndpoint(USB_EP_IN(e), USB_EVT_IN); //Inside this function, a call of UsbHwEpWrite() is made to write the next data frame
} else StartWriteXfer(ep); //start next step of transfer - never called for isoc.ep
}
if (USBCFG_DMA) if (ie & B2) trap(TRAP_USB | USB_ERR_AHB << 16, pdep->DMA);
pdep->INT = ie; //USB.DIEPINTx
}
}
remark:
struct UsbEp {Show Less
enum { //endpoint's states
S_VOID, //do not configured
S_CFG, //is configured
S_IN, //IN-transaction in progress
S_OUT //OUT-transaction in progress
};
union {
struct {
u8 type:2; //The endpoint type
u8 isStalled:1; //Sets if the selected USB endpoint is stalled.
u8 sendZLP:1; //If set, a zero length packet will be send at the end of the transfer
};
u8 attr;
};
u8 volatile state; //one from S_...
u8 address; //The endpoint address including: bits0...3 - endpoint number; bit7 - direction
u8 txFifoNum; //Endpoint transmit Fifo Number
u16 maxPacketSize; //The maximum size of packet for USB endpoint (due to FS Speed device only 64 Byte)
u16 xferLen; //The length of the current transfer
u16 xferCnt; //Bytes transfered of the current USB data transfer
u16 xferTotal; //The length of total data in buffer
u8 *xferBuf; //The buffer of the current transfer
};
typedef __packed u16 u16p8;
typedef __packed s16 s16p8;
typedef __packed u32 u32p8;
typedef __packed s32 s32p8;
typedef __packed u64 u64p8;
typedef __packed s64 s64p8;
typedef __packed u32 u32p16;
typedef __packed s32 s32p16;
typedef __packed u64 u64p16;
typedef __packed s64 s64p16;
typedef __packed u64 u64p32;
typedef __packed s64 s64p32;
XMC™
Hello,I´m not able to select Pins in the XMC 4300 EtherCat example:If i try to select Pin Number (Port) it ends in - Solver time out hast occured.......
Show More
Hello,
I´m not able to select Pins in the XMC 4300 EtherCat example:
If i try to select Pin Number (Port) it ends in - Solver time out hast occured.....
I can generate ,compile and also run the example but I can´t change the pins wit the manual pin allocator. Why? Show Less
I´m not able to select Pins in the XMC 4300 EtherCat example:
If i try to select Pin Number (Port) it ends in - Solver time out hast occured.....
I can generate ,compile and also run the example but I can´t change the pins wit the manual pin allocator. Why? Show Less
Trending discussions