XMC™ Forum Discussions
text.format{('custom.tabs.no.results')}
Hi all,
I have encountered a really strange problem in system_XMC4500.c in SystemCoreClockUpdate:
At some point the clocks are calculated and a UDIV instruction is used for that. The CPU always crashes at that point with an UsageFault telling it sees an Undefined Instruction (UNDEFINSTR bit set). With memory view I decoded the instruction in flash and it is no undefined instruction.
I could narrow down the problem to the following:
- Whenever a previous MUL.W instruction is still in the three-stage pipeline, the CPU panics into the UsageFault.
- When I rearrange the assembly-code so that at least two other instructions are placed before the UDIV, then the code works without a problem.
See these two assembly views:
/* not working (see comments to understand which values are loaded from ram) */
665 uint32_t temp2 = temp/ (pdiv * kdiv);
080429f0: ldr r3, [r7, #16] // 0x04
080429f2: ldr r2, [r7, #8] // 0x02
080429f4: mul.w r3, r2, r3
080429f8: ldr r2, [r7, #20] // 0xb71b00
080429fa: udiv r3, r2, r3
080429fe: str r3, [r7, #4]
/* working (same values in RAM loaded) */
665 uint32_t temp2 = (pdiv * kdiv);
080429f0: ldr r3, [r7, #16]
080429f2: ldr r2, [r7, #8]
080429f4: mul.w r3, r2, r3
080429f8: str r3, [r7, #4]
666 uint32_t temp3 = temp/temp2;
080429fa: ldr r2, [r7, #20]
080429fc: ldr r3, [r7, #4]
080429fe: udiv r3, r2, r3
08042a02: str r3, [r7, #0]
One more thing:
The problem only occurs when I have Segger Debuggers attached to my XMC4500-F1024 target. Free-Running without debugger, the code works with no problem. I tried different debuggers and different versions of J-Link GDB.
Anyone having a guess?
Thanks
Michele Blank
Show LessHi everyone,
I'm trying to build a bootloader base on the tutorial of Infineon XMC4700 USBD Bootloader. I do everything in the tutorial but It doesn't work for me. ABM_0 header, linker script config,... I do all the same as the document below. Bootloader code is running, but when I upload application firmware at ABM_0 location in flash and then trigger software reset to enter the ABM_0, it just doesn't work. I check flash and see the uploaded ABM code is there in flash, but when trigger software system reset to enter ABM_0 mode, it doesn't work. Can anyone help me? I'm using P2G XMC4700 kit.
Show LessHi everyone,
I'm trying to modify linker script file to build my bootloader for XMC4700. I understanded some basic syntax in linkerscript but some of them are to strange to figure out.
In the SECTIONS region in my linker script has this part:
Hi
I try to demo CAN_TRANSMITTER on DAVE IDE.I debug successfully,then I use canalyst to check the message is failed.
I don't know wry the message send is failed. This is my code,please help me.
Thanks
#define CAN_FREQUENCY 144000000
#define CAN_TXD P2_0
#define CAN_RXD P14_3
const XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t baud =
{
.can_frequency = CAN_FREQUENCY,
.baudrate = 500000,
.sample_point = 8000,
.sjw = 1,
};
XMC_CAN_MO_t CAN_message =
{
.can_mo_ptr = CAN_MO0,
.can_priority = XMC_CAN_ARBITRATION_MODE_IDE_DIR_BASED_PRIO_2,
.can_identifier = 0xff,
.can_id_mask = 0xff,
.can_id_mode = XMC_CAN_FRAME_TYPE_STANDARD_11BITS,
.can_ide_mask = 1,
.can_data_length = 2,
.can_mo_type = XMC_CAN_MO_TYPE_TRANSMSGOBJ
.can_data = {0x11223344, 0x55667788},
};
int main(void)
{
/*Configure CAN Module*/
XMC_CAN_InitEx(CAN, XMC_CAN_CANCLKSRC_FPERI, CAN_FREQUENCY);
/*Configure CAN Node baudrate*/
XMC_CAN_NODE_NominalBitTimeConfigure(CAN_NODE0, &baud);
XMC_CAN_NODE_EnableConfigurationChange(CAN_NODE0);
XMC_CAN_NODE_SetInitBit(CAN_NODE0);
/* Configure CAN NODE input pin */
XMC_GPIO_SetMode(CAN_RXD, XMC_GPIO_MODE_INPUT_TRISTATE);
XMC_CAN_NODE_SetReceiveInput(CAN_NODE0, CAN_NODE0_RXD_P14_3);
/*Message Configuration*/
XMC_CAN_MO_Config(&CAN_message);
/*Allocate MO in Node List*/
XMC_CAN_AllocateMOtoNodeList(CAN, 1, 0);
XMC_CAN_NODE_DisableConfigurationChange(CAN_NODE0);
XMC_CAN_NODE_ResetInitBit(CAN_NODE0);
/* Configure CAN NODE output pin */
XMC_GPIO_SetMode(CAN_TXD, XMC_GPIO_MODE_OUTPUT_PUSH_PULL | P2_0_AF_CAN_N0_TXD);
XMC_CAN_MO_UpdateData(&CAN_message);
/* Send data in CAN_message */
XMC_CAN_MO_Transmit(&CAN_message);
}
Show Less
Hi everyone,
last topic with Mr @Owen_Su answers is closed so I have to create a new one to ask more about OTA update firmware of XMC4700. So the answer is I cannot update firmware OTA, but I can update OTA through UART right? Does anyone have example about update firmware through UART? My aim is to use another module transmit firmware through UART to XMC4700, XMC4700 handle it and update new firmware.
Show LessFor the "EVAL_3K3W_TP_PFC_SIC" evaluation board with XMC1404, a GUI tool for configuration is provided in the application note.
The evaluation board "EVAL_3K3W_TP_PFC_CC", which uses the XMC1402 and has similar features, does not mention a GUI tool in its application note.
Is the GUI tool available for this evaluation board?
As I understand about update firmware, we will need at least 3 firm stored in flash: bootloader, application firmware 1 and application firmware 2 for swapping. But I still don't know how to upload 3 firmware to flash? Because each time we upload code to MCU through Jlink, Flash is erase and reload. So how ew can stored multiple firmware on a single flash memory?
Show LessHello,
I'm trying to implement an AB encoder into a Dave app using the ENCODER_POSIF app.
The app itself looked promising. However, I didn't get any usage examples, the documentation only told me that it's been used for other apps for motor control.
I don't plan to control a motor, only get a rotation angle / counter from the AB signal.
Is it possible with this app alone? Or is it better to try it with the CCU module from scratch?
I did some experiments with the supplied functions like ENCODER_POSIF_GetRotorAngle(), but only got wildly counting values.
Any opinion on that?
Thanks!
Show LessI'm using P2G kit to develop a UART communication. I use FIFO buffer to transmit and receive UART Interrupt mode.
Ex:
UART_Receive(&UART_0, uart_instance.payloadISR, sizeof(uart_instance.payloadISR)); (payload is 5 bytes length). FIFO buffer 16 bytes.
I see in the comment of UART_Receive that FIFO buffer will be flushed after I receive full of my desire bytes (here is 5 bytes). But in practice I see that buffer is not flushed as expectec.
For example, I receive 5 bytes, communication is successful as expected. But when I receive 4 bytes, and next time sender send another msg with 5 bytes, 1 byte in the 2nd msg will be fill in the missing one in the 1st msg. Yeah it's ok at this part. But I expect that other 4 bytes remain in 2nd msg will be flushed, so when the 3rd msg with full 5 bytes arrive, it will not occur the situation like the 1st and 2nd msg. But I see that 3rd is still suffer that problem, and other msg continue the same, until the nth msg, everything is ok, 5 bytes receive correctly again (I do not know when the nth msg arrive, sometime it 4th, 8th,... it's not stable). Hope to hear the answer from you guys. Thanks.
How I can implement OTA update firmware on XMC4700? Does anyone have examples of this topic?