I use a Ticker for the https://developer.mbed.org/users/JojoS/code/IRMP/ project to sample an IR signal. Sampling frequency is 15 kHz, Calling the ISR works on a LPC1347 or LPC4088 well, but on the LPC1549 there is a performance problem.
I've checked the mbed lib and found a (significant?) difference in the us_ticker.c/us_ticker_set_interrupt() procedure:
on the LPC1347, this is just setting a register:
\libraries\mbed\targets\hal\TARGET_NXP\TARGET_LPC13XX\us_ticker.c
void us_ticker_set_interrupt(timestamp_t timestamp) {
// set match value
US_TICKER_TIMER->MR0 = (uint32_t)timestamp;
// enable match interrupt
US_TICKER_TIMER->MCR |= 1;
}
on the LPC1549, this is a multiply and bit operation:
\libraries\mbed\targets\hal\TARGET_NXP\TARGET_LPC15XX\us_ticker.c
void us_ticker_set_interrupt(timestamp_t timestamp) {
uint64_t temp = ((uint64_t)timestamp * (SystemCoreClock/1000000));
LPC_RIT->COMPVAL = (temp & 0xFFFFFFFFL);
LPC_RIT->COMPVAL_H = ((temp >> 32)& 0x0000FFFFL);
}
As far as I understand the code, the us_ticker_irqhandler calls this function every _1_µs_, so every more cycle in this irq will have a deep impact on the overall performance. Can anyone confirm this problem? I found already an issue with the 72 min overflow, also caused by using the RIT. Isn't ist better to use a standard 32 bit timer for the ticker implementation?
Edit:
Oo oh, I'm blind. The ISR is not called every usec, the timestamp is the next compare match. But what could be the performance problem?
I use a Ticker for the https://developer.mbed.org/users/JojoS/code/IRMP/ project to sample an IR signal. Sampling frequency is 15 kHz, Calling the ISR works on a LPC1347 or LPC4088 well, but on the LPC1549 there is a performance problem. I've checked the mbed lib and found a (significant?) difference in the us_ticker.c/us_ticker_set_interrupt() procedure:
on the LPC1347, this is just setting a register:
\libraries\mbed\targets\hal\TARGET_NXP\TARGET_LPC13XX\us_ticker.c
on the LPC1549, this is a multiply and bit operation:
\libraries\mbed\targets\hal\TARGET_NXP\TARGET_LPC15XX\us_ticker.c
As far as I understand the code, the us_ticker_irqhandler calls this function every _1_µs_, so every more cycle in this irq will have a deep impact on the overall performance. Can anyone confirm this problem? I found already an issue with the 72 min overflow, also caused by using the RIT. Isn't ist better to use a standard 32 bit timer for the ticker implementation?
Edit: Oo oh, I'm blind. The ISR is not called every usec, the timestamp is the next compare match. But what could be the performance problem?