XMC™ Forum Discussions
XMC™
Hello,in the XMC4200 user manual in chapter 20 page 15 you can read about ressources of fail safe monitor.What are these ressources?to get a little bi...
Show More
Hello,
in the XMC4200 user manual in chapter 20 page 15 you can read about ressources of fail safe monitor.
What are these ressources?
to get a little bit more specific on my case:
I'd like to increase the duty cycle of a switch mode power supply in PCC mode after the start of the controller slowly until it reaches the duty cycle needed for the steady state.
My thought was to clear the low resolution part with the compare signal of the HRPWM and increase this compare signal over time, but unfortunatly thats not possible because i cant connect these two in the HW signal connections overview
I hope somebody can help me. Show Less
in the XMC4200 user manual in chapter 20 page 15 you can read about ressources of fail safe monitor.
What are these ressources?
to get a little bit more specific on my case:
I'd like to increase the duty cycle of a switch mode power supply in PCC mode after the start of the controller slowly until it reaches the duty cycle needed for the steady state.
My thought was to clear the low resolution part with the compare signal of the HRPWM and increase this compare signal over time, but unfortunatly thats not possible because i cant connect these two in the HW signal connections overview
I hope somebody can help me. Show Less
XMC™
Hello,I'm looking for an example on how to realize a Modbus TCP MASTER in a XMC4700.I tried with the example that was provided in DAVE, but I only fou...
Show More
Hello,
I'm looking for an example on how to realize a Modbus TCP MASTER in a XMC4700.
I tried with the example that was provided in DAVE, but I only found Modbus TCP Client.
How can I read and write a Client's register? How can I comunicate with a generic Modbus TCP Client?
Thanks
Oscar Show Less
I'm looking for an example on how to realize a Modbus TCP MASTER in a XMC4700.
I tried with the example that was provided in DAVE, but I only found Modbus TCP Client.
How can I read and write a Client's register? How can I comunicate with a generic Modbus TCP Client?
Thanks
Oscar Show Less
XMC™
Hi all,I'm trying to use the IFX ClassB library on an XMC4800 (link in the Tools & Software section of this page).Documentation references IFXConfigWi...
Show More
Hi all,
I'm trying to use the IFX ClassB library on an XMC4800 (link in the Tools & Software section of this page).
Documentation references IFXConfigWizard that is used to generate the configuration header files.
But I can't find where to get IFXConfigWizard.
A reference here references Infineon Toolbox, which I downloaded and installed.
Also followed the directions in the referenced doc to install the tool, only to find that it only integrates with the Keil toolchain - I'm using gcc / DAVE.
Is there somewhere that IFXConfigWizard is available for my scenario?
Thanks,
--Ed Show Less
I'm trying to use the IFX ClassB library on an XMC4800 (link in the Tools & Software section of this page).
Documentation references IFXConfigWizard that is used to generate the configuration header files.
But I can't find where to get IFXConfigWizard.
A reference here references Infineon Toolbox, which I downloaded and installed.
Also followed the directions in the referenced doc to install the tool, only to find that it only integrates with the Keil toolchain - I'm using gcc / DAVE.
Is there somewhere that IFXConfigWizard is available for my scenario?
Thanks,
--Ed Show Less
XMC™
Hello,I'm looking for said table, eg CCU40.IN0A to PORTS,... basically this https://www.infineonforums.com/threads/6346-CCU4-Input-Selector-Matrix but...
Show More
Hello,
I'm looking for said table, eg CCU40.IN0A to PORTS,... basically this https://www.infineonforums.com/threads/6346-CCU4-Input-Selector-Matrix but for the xmc4400. I can't find it in the xmc4400 data sheet nor in the ccu4 document.
I'm guessing it's the same as above pic for the XMC4800 since same architecture? Still can't find the information in an official document though. Show Less
I'm looking for said table, eg CCU40.IN0A to PORTS,... basically this https://www.infineonforums.com/threads/6346-CCU4-Input-Selector-Matrix but for the xmc4400. I can't find it in the xmc4400 data sheet nor in the ccu4 document.
I'm guessing it's the same as above pic for the XMC4800 since same architecture? Still can't find the information in an official document though. Show Less
XMC™
Hi there,I am writing a bootloader for the XMC4800 that resides in PRAM. To do that I copy the binary code of my application to the PRAM at adress 0x1...
Show More
Hi there,
I am writing a bootloader for the XMC4800 that resides in PRAM. To do that I copy the binary code of my application to the PRAM at adress 0x1FFE8000. That works fine.
Then I copy the ABM header to the end of the PRAM, and here comes my first question. In the manual it says, that the header has to be placed in the last 32 bytes of PSRAM,
but the header consists of 5 32bit words and that makes only 20 bytes. So where to place it? The end of PRAM is 0x1FFFFFFF minus 32 bytes is 0x1FFFFFE0 and
minus 20 bytes is 0x1FFFFFEC. The figure 27-5 in the manual sugests that 0x1FFFFFEC should be right.
I tried both but my PRAM code is not executed. Now I read in the manual, that the SSW writes trace and error codes to a register called SCU_TSW0 and that this register is mirrored
to the TCU (Test Control unit) but I could not figure out how to access and read that.
I run all that on a XMC4800 Relax Kit and I have both DAVE4 and Keil MDK at hand.
Anyone can help me?
Matthias Show Less
I am writing a bootloader for the XMC4800 that resides in PRAM. To do that I copy the binary code of my application to the PRAM at adress 0x1FFE8000. That works fine.
Then I copy the ABM header to the end of the PRAM, and here comes my first question. In the manual it says, that the header has to be placed in the last 32 bytes of PSRAM,
but the header consists of 5 32bit words and that makes only 20 bytes. So where to place it? The end of PRAM is 0x1FFFFFFF minus 32 bytes is 0x1FFFFFE0 and
minus 20 bytes is 0x1FFFFFEC. The figure 27-5 in the manual sugests that 0x1FFFFFEC should be right.
I tried both but my PRAM code is not executed. Now I read in the manual, that the SSW writes trace and error codes to a register called SCU_TSW0 and that this register is mirrored
to the TCU (Test Control unit) but I could not figure out how to access and read that.
I run all that on a XMC4800 Relax Kit and I have both DAVE4 and Keil MDK at hand.
Anyone can help me?
Matthias Show Less
XMC™
In my application I set the BMI mode to ASC BSLTO with a timeout of 5 second. The processor reset, but now no communication is possible.I have connect...
Show More
In my application I set the BMI mode to ASC BSLTO with a timeout of 5 second. The processor reset, but now no communication is possible.
I have connected the Dave4 BMI Get Set tool to both channels, but the BMI Value cannot be read. If I try to set a new BMI value with this tool, it says it cannot read the BMI! This just does not make sense.
When reading it mentions a timeout, is this the 5 seconds timeout, or some other undocumented timeout?
Why is it not possible to read the current setting or write a new setting? I am using the Boot Kit debugger.
I would expect the processor to boot from Flash after 5 seconds, but this does not happen, why? What can I have done wrong? I set the boot mode to 0x50 with a timeout of 0xF. Show Less
I have connected the Dave4 BMI Get Set tool to both channels, but the BMI Value cannot be read. If I try to set a new BMI value with this tool, it says it cannot read the BMI! This just does not make sense.
When reading it mentions a timeout, is this the 5 seconds timeout, or some other undocumented timeout?
Why is it not possible to read the current setting or write a new setting? I am using the Boot Kit debugger.
I would expect the processor to boot from Flash after 5 seconds, but this does not happen, why? What can I have done wrong? I set the boot mode to 0x50 with a timeout of 0xF. Show Less
XMC™
HelloI wrote a simple code to communicate between an XMC an a 24FC512 EEPROM using DMA. DMA has been configured using DAVE.In Step 1, two data bytes a...
Show More
Hello
I wrote a simple code to communicate between an XMC an a 24FC512 EEPROM using DMA. DMA has been configured using DAVE.
In Step 1, two data bytes are written.
in Step 2, two data bytes are read back
The code works fine if I only run Step 1 or Step 2 of the program (comment out).
If I run the total program code, then the the program stucks in in the while loop "while (I2C_MASTER_IsRxBusy(&I2C_MASTER_0));"
after calling I2C_MASTER_StartReceiveDMA(&I2C_MASTER_0, 2, rx_buf); The interrupt is not called. Also a Stop bit is created although the program stucks in the loop.
Attached also the logic analysis of the read operation. One time when it fails and one time when it is OK.
Thank you for your hints
Geri Show Less
I wrote a simple code to communicate between an XMC an a 24FC512 EEPROM using DMA. DMA has been configured using DAVE.
In Step 1, two data bytes are written.
in Step 2, two data bytes are read back
The code works fine if I only run Step 1 or Step 2 of the program (comment out).
If I run the total program code, then the the program stucks in in the while loop "while (I2C_MASTER_IsRxBusy(&I2C_MASTER_0));"
after calling I2C_MASTER_StartReceiveDMA(&I2C_MASTER_0, 2, rx_buf); The interrupt is not called. Also a Stop bit is created although the program stucks in the loop.
int main(void)
{
DAVE_STATUS_t init_status;
uint8_t tx_buf[128];
uint8_t Adr_buf[128];
uint32_t i;
init_status = DAVE_Init();
if(init_status == DAVE_STATUS_SUCCESS)
{
// Step 1: write some bytes to I2C EEPROM------------------------------------------------------------------------------
tx_buf[0] = 0; // addr hi
tx_buf[1] = 0; // adr lo
tx_buf[2] = 0xAB; // data byte 1
tx_buf[3] = 0xCD; // data byte 2
I2C_MASTER_SendStart(&I2C_MASTER_0, SLAVE_ADDRESS, XMC_I2C_CH_CMD_WRITE);
while(I2C_MASTER_GetFlagStatus(&I2C_MASTER_0, XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED) == 0U)
{
// wait for ACK
}
I2C_MASTER_ClearFlag(&I2C_MASTER_0,XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED);
I2C_MASTER_StartTransmitDMA(&I2C_MASTER_0, 4, &tx_buf[0]);
while(I2C_MASTER_IsTxBusy(&I2C_MASTER_0));
I2C_MASTER_SendStop(&I2C_MASTER_0);
for (i=0;i<200000;i++); // wait a little bit until data has been saved inside EEPROM
// Step 2: read back 2 bytes from I2C EEPROM --------------------------------------------------------------------
I2C_MASTER_SendStart(&I2C_MASTER_0, SLAVE_ADDRESS, XMC_I2C_CH_CMD_WRITE);
while(I2C_MASTER_GetFlagStatus(&I2C_MASTER_0, XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED) == 0U)
{
// wait for ACK
}
I2C_MASTER_ClearFlag(&I2C_MASTER_0,XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED);
// select address
Adr_buf[0] = 0; // hi byte of start address to read
Adr_buf[1] = 0; // lo byte of start address to read
I2C_MASTER_StartTransmitDMA(&I2C_MASTER_0, 2, &Adr_buf[0]); // set address
while (I2C_MASTER_IsTxBusy(&I2C_MASTER_0));
I2C_MASTER_SendRepeatedStart(&I2C_MASTER_0, SLAVE_ADDRESS, XMC_I2C_CH_CMD_READ);
while(I2C_MASTER_GetFlagStatus(&I2C_MASTER_0, XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED) == 0U)
{
// wait for ACK
}
I2C_MASTER_ClearFlag(&I2C_MASTER_0,XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED);
I2C_MASTER_StartReceiveDMA(&I2C_MASTER_0, 2, rx_buf);
while (I2C_MASTER_IsRxBusy(&I2C_MASTER_0)); // programs stucks in while loop, rx interrupt from DMA not triggered
I2C_MASTER_SendStop(&I2C_MASTER_0);
}
else
{
XMC_DEBUG("main: Application initialization failed");
}
while(1U)
{
}
return 1U;
}
Attached also the logic analysis of the read operation. One time when it fails and one time when it is OK.
Thank you for your hints
Geri Show Less
XMC™
Hey Guys,I just got my ordered xmc 4500 Relax Kit Lite.Unfortunately when I plug the board (both sides) into my laptop (Win10) the debug LED keeps bli...
Show More
Hey Guys,
I just got my ordered xmc 4500 Relax Kit Lite.
Unfortunately when I plug the board (both sides) into my laptop (Win10) the debug LED keeps blinking fast.
The Power LED is normal. What does that mean?
Dave Version 3.1.10 installed & JlinkARM_V484 installed as well.
J-Link commander doesn‘t find the board as well. Already tried different micro usb cables.
Do you guys have any idea about my problem?
Thank you guys,
Best regards
JJ Show Less
I just got my ordered xmc 4500 Relax Kit Lite.
Unfortunately when I plug the board (both sides) into my laptop (Win10) the debug LED keeps blinking fast.
The Power LED is normal. What does that mean?
Dave Version 3.1.10 installed & JlinkARM_V484 installed as well.
J-Link commander doesn‘t find the board as well. Already tried different micro usb cables.
Do you guys have any idea about my problem?
Thank you guys,
Best regards
JJ Show Less
XMC™
I have got 2 boards, both with external SDRAM. One is the Infineon CPU_45B-V1 evaluation board and one is our own design. Both board are showing the s...
Show More
I have got 2 boards, both with external SDRAM. One is the Infineon CPU_45B-V1 evaluation board and one is our own design. Both board are showing the same problem during debugging.
My test program uses printf to send some text to the output via the ITM redirection. If the code runs from internal FLASH the output can be seen in the debugger serial viewer window, but if the code is configured to run from the external SDRAM, no output is visible.
Looking at the pinout I can see that the TDI (Port 0.7) is also used as the EBU D6 signal and the TDO (Port 2.1) is used as the EBU AD21. Therefore I am no that surprised that it does not work!
Can you confirm that it is not possible to use the ITM when external RAM is connected? This would seem to be a major design error in the pinout if this is the case. Or do I just need to change something in the configuration?
We need to use the external RAM and the ITM at the same time. Show Less
My test program uses printf to send some text to the output via the ITM redirection. If the code runs from internal FLASH the output can be seen in the debugger serial viewer window, but if the code is configured to run from the external SDRAM, no output is visible.
Looking at the pinout I can see that the TDI (Port 0.7) is also used as the EBU D6 signal and the TDO (Port 2.1) is used as the EBU AD21. Therefore I am no that surprised that it does not work!
Can you confirm that it is not possible to use the ITM when external RAM is connected? This would seem to be a major design error in the pinout if this is the case. Or do I just need to change something in the configuration?
We need to use the external RAM and the ITM at the same time. Show Less
XMC™
Hello,I'm debugging sporadic Lockups in my XMC4500 application. After turning on fault debugging it appears memory faults are occurring in the SYSTIME...
Show More
Hello,
I'm debugging sporadic Lockups in my XMC4500 application. After turning on fault debugging it appears memory faults are occurring in the SYSTIMER timer list handling code that is called from SDMMC module. I added some redundant NULL checks and they trigger.
Here is the full backtrace:
Here is what it looks like in DAVE, you can see the additional NULL checks I've put in:
I am at a loss here - the chain of if/else statements in the SYSTIMER_lRemoveTimerList should already make sure that this branch is only entered when object_ptr->prev is valid. So that is what's making me think it's a reentrancy bug / data race where maybe an interrupt manipulates the timer table independently.
Colleagues are reporting to me that the fault has also happened in the SYSTIMER_StopTimer function.
I am using another SYSTIMER for something different:
As you can see, I am not manipulating the timer from its own callback, I only set a signalling variable and the timer manipulation (lcd_start / lcd_consume) is only ever called directly from my main() function so this shouldn't interfere.
Any ideas? Show Less
I'm debugging sporadic Lockups in my XMC4500 application. After turning on fault debugging it appears memory faults are occurring in the SYSTIMER timer list handling code that is called from SDMMC module. I added some redundant NULL checks and they trigger.
Here is the full backtrace:
Program received signal SIGTRAP, Trace/breakpoint trap.
SYSTIMER_lRemoveTimerList (tbl_index=2) at ../Dave/Generated/SYSTIMER/systimer.c:245
245 __BKPT(0);
bt
#0 SYSTIMER_lRemoveTimerList (tbl_index=2) at ../Dave/Generated/SYSTIMER/systimer.c:245
#1 0x08027f18 in SYSTIMER_StopTimer (id=3) at ../Dave/Generated/SYSTIMER/systimer.c:503
#2 0x0802b5c6 in SDMMC_BLOCK_SD_lStopTimer (obj=0x200001a8) at ../Dave/Generated/SDMMC_BLOCK/sdmmc_block_private_sd.c:2077
#3 0x0802aa60 in SDMMC_BLOCK_SD_lSingleBlockTransfer (obj=0x200001a8, cmd=0x8037426 , arg=56771, block_size=512, buf=0x2000414c , transfer_mode=SDMMC_BLOCK_SD_DATA_TRANSFER_WRITE_BUFFER) at ../Dave/Generated/SDMMC_BLOCK/sdmmc_block_private_sd.c:1291
#4 0x0802ba4a in SDMMC_BLOCK_SD_lCardWriteSingleBlock (obj=0x200001a8, write_buf=0x2000414c , write_addr=56771) at ../Dave/Generated/SDMMC_BLOCK/sdmmc_block_private_sd.c:2391
#5 0x0802c374 in SDMMC_BLOCK_SD_WriteBlock (obj=0x200001a8, write_buf=0x2000414c "5655800;6991;999;0.000031;351;999;-0.000836;4093130;999;-0.001110;-0.000000;118.630000\r\n7157175;715717500;6994;999;0.000075;320;999;-0.000867;4093019;999;-0.001801;-0.000000;118.640000\r\n7157774;715777"..., sector_num=56771, sector_count=1 '\001') at ../Dave/Generated/SDMMC_BLOCK/sdmmc_block_private_sd.c:2934
#6 0x080290a2 in SDMMC_BLOCK_WriteBlock (obj=0x200001a8, write_buf=0x2000414c "5655800;6991;999;0.000031;351;999;-0.000836;4093130;999;-0.001110;-0.000000;118.630000\r\n7157175;715717500;6994;999;0.000075;320;999;-0.000867;4093019;999;-0.001801;-0.000000;118.640000\r\n7157774;715777"..., sector_number=56771, sector_count=1 '\001') at ../Dave/Generated/SDMMC_BLOCK/sdmmc_block.c:250
#7 0x0802fd3c in disk_write (drive=0 '\000', buffer=0x2000414c"5655800;6991;999;0.000031;351;999;-0.000836;4093130;999;-0.001110;-0.000000;118.630000\r\n7157175;715717500;6994;999;0.000075;320;999;-0.000867;4093019;999;-0.001801;-0.000000;118.640000\r\n7157774;715777"..., sectornumber=56771, sectorcount=1) at ../Dave/Generated/FATFS/fatfs.c:294
#8 0x0802ed46 in f_write (fp=0x20004124, buff=0x100006bc, btw=64, bw=0x1000073c) at ../Dave/Generated/FATFS/ff_Src/ff.c:2694
#9 0x080325ae in jm_integrate (state=0x20003e50, time=7159564) at ../joulemeter.c:601
#10 0x08032ddc in main () at ../main.c:577
bt full
#0 SYSTIMER_lRemoveTimerList (tbl_index=2) at ../Dave/Generated/SYSTIMER/systimer.c:245
object_ptr = 0x20003d14
#1 0x08027f18 in SYSTIMER_StopTimer (id=3) at ../Dave/Generated/SYSTIMER/systimer.c:503
status = SYSTIMER_STATUS_SUCCESS
#2 0x0802b5c6 in SDMMC_BLOCK_SD_lStopTimer (obj=0x200001a8) at ../Dave/Generated/SDMMC_BLOCK/sdmmc_block_private_sd.c:2077
tmr_id = 3
status = 168099
#3 0x0802aa60 in SDMMC_BLOCK_SD_lSingleBlockTransfer (obj=0x200001a8, cmd=0x8037426 , arg=56771, block_size=512, buf=0x2000414c , transfer_mode=SDMMC_BLOCK_SD_DATA_TRANSFER_WRITE_BUFFER) at ../Dave/Generated/SDMMC_BLOCK/sdmmc_block_private_sd.c:1291
status = SDMMC_BLOCK_MODE_STATUS_SUCCESS
qbytes = 128
#4 0x0802ba4a in SDMMC_BLOCK_SD_lCardWriteSingleBlock (obj=0x200001a8, write_buf=0x2000414c , write_addr=56771) at ../Dave/Generated/SDMMC_BLOCK/sdmmc_block_private_sd.c:2391
status = SDMMC_BLOCK_MODE_STATUS_SUCCESS
sector_count = 1
#5 0x0802c374 in SDMMC_BLOCK_SD_WriteBlock (obj=0x200001a8, write_buf=0x2000414c "5655800;6991;999;0.000031;351;999;-0.000836;4093130;999;-0.001110;-0.000000;118.630000\r\n7157175;715717500;6994;999;0.000075;320;999;-0.000867;4093019;999;-0.001801;-0.000000;118.640000\r\n7157774;715777"..., sector_num=56771, sector_count=1 '\001') at ../Dave/Generated/SDMMC_BLOCK/sdmmc_block_private_sd.c:2934
status = SDMMC_BLOCK_MODE_STATUS_CARD_IS_LOCKED
disk_status = 64 '@'
res = SDMMC_BLOCK_STATUS_SUCCESS
#6 0x080290a2 in SDMMC_BLOCK_WriteBlock (obj=0x200001a8, write_buf=0x2000414c "5655800;6991;999;0.000031;351;999;-0.000836;4093130;999;-0.001110;-0.000000;118.630000\r\n7157175;715717500;6994;999;0.000075;320;999;-0.000867;4093019;999;-0.001801;-0.000000;118.640000\r\n7157774;715777"..., sector_number=56771, sector_count=1 '\001') at ../Dave/Generated/SDMMC_BLOCK/sdmmc_block.c:250
status = SDMMC_BLOCK_STATUS_SUCCESS
#7 0x0802fd3c in disk_write (drive=0 '\000', buffer=0x2000414c"5655800;6991;999;0.000031;351;999;-0.000836;4093130;999;-0.001110;-0.000000;118.630000\r\n7157175;715717500;6994;999;0.000075;320;999;-0.000867;4093019;999;-0.001801;-0.000000;118.640000\r\n7157774;715777"..., sectornumber=56771, sectorcount=1) at ../Dave/Generated/FATFS/fatfs.c:294
diskresult = 32
result = 268437180
#8 0x0802ed46 in f_write (fp=0x20004124, buff=0x100006bc, btw=64, bw=0x1000073c) at ../Dave/Generated/FATFS/ff_Src/ff.c:2694
res = FR_OK
clst = 134423947
sect = 1064925179
wcnt = 34
cc = 213424158
wbuff = 0x100006de "1;383;999;-0.000805;4093197;999;-0.000693;-0.000000;118.680000\r\n"
csect = 4 '\004'
#9 0x080325ae in jm_integrate (state=0x20003e50, time=7159564) at ../joulemeter.c:601
line = "7159564;715956400;6991;999;0.000031;383;999;-0.000805;4093197;999;-0.000693;-0.000000;118.680000\r\n\000 \000\000\000`(\a\000\020\060\a\000\020�\211\002\b\002\000\000\000�\000\000 \000 \a"
sz = 98
sz2 = 34
totalbw = 1148605
avg_volt = 3.1000802802813587e-005
avg_curr = -0.00080453280810810815
timespan = 597
timespan_secs = 0.059699999999999996
retj = {d = 118.68000000585268, u = {515807921, 1079880581}}
joules = -1.4889874270734333e-009
lmp_volt_avg = 6.9979979979979978
lmp_curr_avg = 0.3833833833833834
tli_curr_avg = 4097.2942942942946
tli_curr = -0.00069343868257831787
lmp_curr = -0.00080453280810810815
lmp_volt = 3.1000802802813587e-005
#10 0x08032ddc in main () at ../main.c:577
last_button_span = 7159563
timespan = 597
status = DAVE_STATUS_SUCCESS
vcom_st = USBD_VCOM_STATUS_DEVICE_UNATTACHED
usbwait = 0
Here is what it looks like in DAVE, you can see the additional NULL checks I've put in:
I am at a loss here - the chain of if/else statements in the SYSTIMER_lRemoveTimerList should already make sure that this branch is only entered when object_ptr->prev is valid. So that is what's making me think it's a reentrancy bug / data race where maybe an interrupt manipulates the timer table independently.
Colleagues are reporting to me that the fault has also happened in the SYSTIMER_StopTimer function.
I am using another SYSTIMER for something different:
static uint32_t tmr;
static uint8_t consume_pending;
void lcd_consume() {
if (consume_pending) {
uint32_t interval = 10000;
if (queue_first != queue_free) {
lcd_set();
queue_first = (queue_first + 1) % LCD_QLEN;
interval = queue[queue_first].ts + SYSTIMER_TICK_PERIOD_US;
}
consume_pending = 0;
SYSTIMER_RestartTimer(tmr, interval);
}
}
void lcd_callback(void* args) {
consume_pending = 1;
}
void lcd_start() {
tmr = SYSTIMER_CreateTimer(SYSTIMER_TICK_PERIOD_US, SYSTIMER_MODE_ONE_SHOT,
&lcd_callback,
NULL);
if (tmr) {
SYSTIMER_StartTimer(tmr);
} else {
while (1U) {
; // trap
}
}
lcd_callback(NULL);
}
As you can see, I am not manipulating the timer from its own callback, I only set a signalling variable and the timer manipulation (lcd_start / lcd_consume) is only ever called directly from my main() function so this shouldn't interfere.
Any ideas? Show Less
Trending discussions