XMC™ Forum Discussions
XMC™
Hi...All, what configuration we supposed to do for continuously receiving CAN message in particular MO?in my code i have to used CAN configura...
Show More
Hi...All,
what configuration we supposed to do for continuously receiving CAN message in particular MO?
in my code i have to used CAN configuration Function Call In "While" loop...!! if i dont use it in "While"then its able to receive for only once.And whats the function of RTSEL bit in MO configuration?? Show Less
what configuration we supposed to do for continuously receiving CAN message in particular MO?
in my code i have to used CAN configuration Function Call In "While" loop...!! if i dont use it in "While"then its able to receive for only once.And whats the function of RTSEL bit in MO configuration?? Show Less
XMC™
Hello,I just started experimenting with the XMC1100 Boot Kit and simply want to set up the timer to get it running. But i am facing some problems and ...
Show More
Hello,
I just started experimenting with the XMC1100 Boot Kit and simply want to set up the timer to get it running. But i am facing some problems and could not find any solution through the internet. Maybe somebody can help me with my problem.
This is my code:
The while loop is only to check the current state of the register bit. However, nothing of the code concerning the timer slice is working.
The bits I want to set in the initCCU4 are not written to the registers. I also checked these registers in the debug mode and they are not affected by my code. Any ideas why I cannot write these bits?
Thanks! Show Less
I just started experimenting with the XMC1100 Boot Kit and simply want to set up the timer to get it running. But i am facing some problems and could not find any solution through the internet. Maybe somebody can help me with my problem.
This is my code:
#include//SFR declarations of the selected device
void activate_LED(uint8_t state)
{
if(state == 1)
{
PORT0 -> OUT !=~(1 << PORT0_OUT_P5_Pos) & (1 << PORT0_OUT_P6_Pos); //activate low active LEDs
PORT1 -> OUT !=~(1 << PORT1_OUT_P2_Pos) & (1 << PORT1_OUT_P3_Pos) & (1 << PORT1_OUT_P4_Pos) & (1 << PORT1_OUT_P5_Pos); //activate low active LEDs
}
else
{
PORT0 -> OUT |= (1 << PORT0_OUT_P5_Pos) | (1 << PORT0_OUT_P6_Pos); //activate low active LEDs
PORT1 -> OUT |= (1 << PORT1_OUT_P2_Pos) | (1 << PORT1_OUT_P3_Pos) | (1 << PORT1_OUT_P4_Pos) | (1 << PORT1_OUT_P5_Pos); //activate low active LEDs
}
}
void initCCU4()
{
SCU_CLK -> CGATSET0 |= (1 << SCU_CLK_CGATSET0_CCU40_Pos); //activate CLK for CCU40
CCU40 -> GIDLC |= (1 << CCU4_GIDLC_SPRB_Pos); //set prescaler run bit
CCU40_CC40 -> PSC |= (0b1000 << CCU4_CC4_PSC_PSIV_Pos); //set prescaler to 256
CCU40 -> GIDLC |= (1 << CCU4_GIDLC_CS0I_Pos); //clear idle mode CCU40
SCU_GENERAL-> CCUCON |= (1 << SCU_GENERAL_CCUCON_GSC40_Pos); //Global Enable CCU40_CC40
CCU40_CC40 -> TCSET |= (1 << CCU4_CC4_TCSET_TRBS_Pos); //Set timer run bit
}
int main(void)
{
PORT0 -> IOCR4 |= (0b10000 << PORT0_IOCR4_PC5_Pos) | (0b10000 << PORT0_IOCR4_PC6_Pos); //Set P0.5 & P0.6 as output
PORT1 -> IOCR0 |= (0b10000 << PORT1_IOCR0_PC2_Pos) | (0b10000 << PORT1_IOCR0_PC3_Pos); //Set P1.2 & P1.3 as output
PORT1 -> IOCR4 |= (0b10000 << PORT1_IOCR4_PC4_Pos) | (0b10000 << PORT1_IOCR4_PC5_Pos); //Set P1.4 & P1.5 as output
initCCU4();
while(1)
{
if((CCU40 -> GIDLC & (1 << CCU4_GIDLC_CS0I_Pos)) == (1 << CCU4_GIDLC_CS0I_Pos))
{
activate_LED(1);
}
else
{
activate_LED(0);
}
}
return 0;
}
The while loop is only to check the current state of the register bit. However, nothing of the code concerning the timer slice is working.
The bits I want to set in the initCCU4 are not written to the registers. I also checked these registers in the debug mode and they are not affected by my code. Any ideas why I cannot write these bits?
Thanks! Show Less
XMC™
Hi,could someone please explain how to use CCU8 timer in Single Shot Mode when two slices are concatenated (2x16bit)? What value should be written to ...
Show More
Hi,
could someone please explain how to use CCU8 timer in Single Shot Mode when two slices are concatenated (2x16bit)? What value should be written to period match registers of each slices eg. when delay is set to 0x00010000?
Best regards,
Mariusz Show Less
could someone please explain how to use CCU8 timer in Single Shot Mode when two slices are concatenated (2x16bit)? What value should be written to period match registers of each slices eg. when delay is set to 0x00010000?
Best regards,
Mariusz Show Less
XMC™
I want to store some data into xmc4500's flash . It's memtion that "flash--64 KB on-chip high speed data memory" in xmc4500 reference manual. Does any...
Show More
I want to store some data into xmc4500's flash . It's memtion that "flash--64 KB on-chip high speed data memory" in xmc4500 reference manual.
Does anybody provide any demo or example to preform write data into flash and read data from flash? Show Less
Does anybody provide any demo or example to preform write data into flash and read data from flash? Show Less
XMC™
Hello,I downloaded the DAVE example Compare ADCSYNC001_Example1 and I am able to achieve 2 of the voltage level. However, the purpose of it is to minu...
Show More
Hello,
I downloaded the DAVE example Compare ADCSYNC001_Example1 and I am able to achieve 2 of the voltage level. However, the purpose of it is to minus the 2 values and update the PWM accordingly
For example when the value is less than 1500 then the program should update the PWM accordingly. I am really unsure of how should I come about in doing this. Can I use the software connectivity APP? if yes which app should I use?
Can anyone help me out in this please? (I am using XMC1200) Show Less
I downloaded the DAVE example Compare ADCSYNC001_Example1 and I am able to achieve 2 of the voltage level. However, the purpose of it is to minus the 2 values and update the PWM accordingly
For example when the value is less than 1500 then the program should update the PWM accordingly. I am really unsure of how should I come about in doing this. Can I use the software connectivity APP? if yes which app should I use?
Can anyone help me out in this please? (I am using XMC1200) Show Less
XMC™
Hello for my project I choosed the XMC2GO because of its really nice size and features.I want to control up to three PCA9685 PWM drivers over I2C as w...
Show More
Hello for my project I choosed the XMC2GO because of its really nice size and features.
I want to control up to three PCA9685 PWM drivers over I2C as well as a MCP23017 I/O expander.
My application is able to send commands over I2C to the PCA9685.
So I can write to the registers but only if I use the debugger by going step by step trough the code.
Otherwise nothing happens. But if I step through the code, after a while of sending data to the registers, the debugger crashes while debugging the function "writeRegisterPCA9685".
The registers of the USIC0_CH1 don't change anymore and the debugger crashes after another few steps.
Do I have to check whether the transmit buffer is free or whats my mistake?
I initialize the I2C on P2.10 and P2.11 with the DAVE APP on 400kBaud.
Also I used the example code of DAVE for the transmission.
Another problem is to receive data.
I don't really know whether the PCA9685 answers, because I don't have an oszilloscope to measure it, but I believe that it does because I can write to it's registers, which change the state of the LEDs.
So I think that it replys if I want to read a register, but the controller doesn't recognized it.
I initialize the Interrupt with the NVIC002, but the interrupt handler function will never be called.
For this code I also used the example of the DAVE App which was designed for the PCA9502 which is very similar to the PCA9685.
Can anybody help me with my problem?
Greetings from Germany
Christian
Code of my project:
Show Less
I want to control up to three PCA9685 PWM drivers over I2C as well as a MCP23017 I/O expander.
My application is able to send commands over I2C to the PCA9685.
So I can write to the registers but only if I use the debugger by going step by step trough the code.
Otherwise nothing happens. But if I step through the code, after a while of sending data to the registers, the debugger crashes while debugging the function "writeRegisterPCA9685".
The registers of the USIC0_CH1 don't change anymore and the debugger crashes after another few steps.
Do I have to check whether the transmit buffer is free or whats my mistake?
I initialize the I2C on P2.10 and P2.11 with the DAVE APP on 400kBaud.
Also I used the example code of DAVE for the transmission.
// Functions to read and write registers of the PCA9685
bool writeRegisterPCA9685(uint8_t deviceAddress, uint8_t registerAddress, uint8_t registerData){
returnVal = (bool)FALSE;
actualDeviceAddress = (((deviceAddress << 0x01) | 0x80) & PCA9685_WRITE);
// Send START condition as well as slave address and read/write command
deviceSlaveAddress.Data1.TDF_Type = I2C_TDF_MStart;
deviceSlaveAddress.Data1.Data = actualDeviceAddress;
I2C001_WriteData(&I2C001_Handle0, &deviceSlaveAddress);
// Acknowledge & Send control register address
deviceRegisterAddress.Data1.TDF_Type = I2C_TDF_MTxData;
deviceRegisterAddress.Data1.Data = registerAddress;
I2C001_WriteData(&I2C001_Handle0, &deviceRegisterAddress);
// Acknowledge & Send data for registers
deviceRegisterData.Data1.TDF_Type = I2C_TDF_MTxData;
deviceRegisterData.Data1.Data = registerData;
I2C001_WriteData(&I2C001_Handle0, &deviceRegisterData);
// Acknowledge & Send STOP condition
stopCondition.Data1.TDF_Type = I2C_TDF_MStop;
stopCondition.Data1.Data = ubyteFF;
I2C001_WriteData(&I2C001_Handle0, &stopCondition);
return returnVal;
}
Another problem is to receive data.
I don't really know whether the PCA9685 answers, because I don't have an oszilloscope to measure it, but I believe that it does because I can write to it's registers, which change the state of the LEDs.
So I think that it replys if I want to read a register, but the controller doesn't recognized it.
I initialize the Interrupt with the NVIC002, but the interrupt handler function will never be called.
For this code I also used the example of the DAVE App which was designed for the PCA9502 which is very similar to the PCA9685.
uint16_t readRegisterPAC9685(uint8_t deviceAddress, uint8_t registerAddress){
actualDeviceAddress = (((deviceAddress << 0x01) | 0x80) | 0x01); // Combine device address with read flag
// Send START condition as well as slave address and read flag
deviceSlaveAddress.Data1.TDF_Type = I2C_TDF_MStart;
deviceSlaveAddress.Data1.Data = actualDeviceAddress;
while(!(I2C001_WriteData(&I2C001_Handle0, &deviceSlaveAddress)));
// Acknowledge & Send control register address
deviceRegisterAddress.Data1.TDF_Type = I2C_TDF_MTxData;
deviceRegisterAddress.Data1.Data = registerAddress;
while(!(I2C001_WriteData(&I2C001_Handle0, &deviceRegisterAddress)));
// Transmit repeated start condition and slave address
deviceRegisterData.Data1.TDF_Type = I2C_TDF_MRStart;
deviceRegisterData.Data1.Data = actualDeviceAddress;
I2C001_WriteData(&I2C001_Handle0, &deviceRegisterData);
// Read Data from slave
deviceReadData.Data1.TDF_Type = I2C_TDF_MRxAck1;
deviceReadData.Data1.Data = ubyteFF;
I2C001_WriteData(&I2C001_Handle0, & deviceReadData);
// Send STOP condition
stopCondition.Data1.TDF_Type = I2C_TDF_MStop;
stopCondition.Data1.Data = ubyteFF;
I2C001_WriteData(&I2C001_Handle0, &stopCondition);
return actualDataReceived;
}
void FIFO_Receive_Int_Handler(void){
actualDataReceived = 0x0000;
successfullDataReceived = (bool)FALSE;
// Read receive FIFO buffer and put the data to "actualDataReceived"
I2C001_ReadData(&I2C001_Handle0, &actualDataReceived);
// If the FIFO buffer is 0xFFFF there were no valid data received
if(actualDataReceived != 0xFFFF){
successfullDataReceived = (bool)TRUE;
}
}
Can anybody help me with my problem?
Greetings from Germany
Christian
Code of my project:
Show Less
XMC™
XMC4500F100K1024 AB:I am a bit at a loss trying to set up a CAN RX FIFO.DAVE App CAN001[1.0.8] have no setting for this, and none of the examples in t...
Show More
XMC4500F100K1024 AB:
I am a bit at a loss trying to set up a CAN RX FIFO.
DAVE App CAN001[1.0.8] have no setting for this, and none of the examples in the example library seems to provide an example.
I already have a CAN node running with 1 LMO for TX and 1 for RX, but we are experiencing packet loss, and would like to set up a RX FIFO of say 32 LMOs.
1 LMO for TX is fine.
Could you please provide some example code for this?
Cheers Show Less
I am a bit at a loss trying to set up a CAN RX FIFO.
DAVE App CAN001[1.0.8] have no setting for this, and none of the examples in the example library seems to provide an example.
I already have a CAN node running with 1 LMO for TX and 1 for RX, but we are experiencing packet loss, and would like to set up a RX FIFO of say 32 LMOs.
1 LMO for TX is fine.
Could you please provide some example code for this?
Cheers Show Less
XMC™
i wanted to ask a few basic question regarding CAN configuration on XMC4500...1. If you dont enable the loopback mode does the CAN node itself connect...
Show More
i wanted to ask a few basic question regarding CAN configuration on XMC4500...
1. If you dont enable the loopback mode does the CAN node itself connects to the external TX and RX or do you have to tell it to be setting some bit, if you have to which bit it is?
2. There are 16 interrupts line but on Keil uVision 5' System Viewer it says that only CAN0,1,2,3 and 7 interrupts can be used where as in startup files there are only 8 interrupts.
3. Can i test external bus by connecting the Tx of Node 0 with Rx of Node 1 and simillarly for Rx of Node 0 without using the transceiver IC?
4. You can select the Rx line by RXSEL fiel in NPCR but can you do anything about the Tx for CAN nodes or the signal is forwarded to all of the connected Tx to the node and is used on only those lines where
the Port configuration corresponds to the alternate function for CANx.Tx?
Thanks in advance.. Show Less
1. If you dont enable the loopback mode does the CAN node itself connects to the external TX and RX or do you have to tell it to be setting some bit, if you have to which bit it is?
2. There are 16 interrupts line but on Keil uVision 5' System Viewer it says that only CAN0,1,2,3 and 7 interrupts can be used where as in startup files there are only 8 interrupts.
3. Can i test external bus by connecting the Tx of Node 0 with Rx of Node 1 and simillarly for Rx of Node 0 without using the transceiver IC?
4. You can select the Rx line by RXSEL fiel in NPCR but can you do anything about the Tx for CAN nodes or the signal is forwarded to all of the connected Tx to the node and is used on only those lines where
the Port configuration corresponds to the alternate function for CANx.Tx?
Thanks in advance.. Show Less
XMC™
Hi,I have configured the USIC1_CH1 with SCTR.WLE=16, SCTR.FLE=30 and CCR.PM=Odd Mode. The Datasheet says that the USIC sends 31 bits and adds 1 Parity...
Show More
Hi,
I have configured the USIC1_CH1 with SCTR.WLE=16, SCTR.FLE=30 and CCR.PM=Odd Mode. The Datasheet says that the USIC sends 31 bits and adds 1 Parity bit at the end of the frame (32 Bits).
If I send an even/odd number of bits (4 bytes complete) over the USIC, no parity information will be added in data and no additional clock cycle will be added to the end of the frame. Do I have to configure some more options?
The data is written into the FIFO and TCI informations are not used.
I have the XMC4500 F144K1024 AC EES
Thanks
thk Show Less
I have configured the USIC1_CH1 with SCTR.WLE=16, SCTR.FLE=30 and CCR.PM=Odd Mode. The Datasheet says that the USIC sends 31 bits and adds 1 Parity bit at the end of the frame (32 Bits).
If I send an even/odd number of bits (4 bytes complete) over the USIC, no parity information will be added in data and no additional clock cycle will be added to the end of the frame. Do I have to configure some more options?
The data is written into the FIFO and TCI informations are not used.
I have the XMC4500 F144K1024 AC EES
Thanks
thk Show Less