Closed caco3 closed 4 years ago
Are you disabling interrupts for a long time? This would be you calling irq_lock()
and then not unlocking them with an irq_unlock()
for a long period of time.
Also can you please provide a little more information, such as the board you are building for and the full configuration you are using? (please attach your build/zephyr/.config
file).
@carlescufi Thanks for your support!
Below some code excerpt:
void main(void) {
NRF_TIMER2->MODE = TIMER_MODE_MODE_Timer; // Set the timer in Counter Mode
NRF_TIMER2->TASKS_CLEAR = 1; // clear the task first to be usable for later
NRF_TIMER2->PRESCALER = 4; // Set prescaler. 16 MHz / 2^4 = 1 MHz
NRF_TIMER2->BITMODE = TIMER_BITMODE_BITMODE_16Bit; // Set counter to 16 bit resolution
NRF_TIMER2->CC[0] = intervalUs; // Set value for TIMER2 compare register 0
NRF_TIMER2->INTENSET = TIMER_INTENSET_COMPARE0_Enabled << TIMER_INTENSET_COMPARE0_Pos;
NRF_TIMER2->SHORTS = TIMER_SHORTS_COMPARE0_CLEAR_Enabled << TIMER_SHORTS_COMPARE0_CLEAR_Pos;
NVIC_EnableIRQ(TIMER2_IRQn); // Enable the interrupt
NRF_TIMER2->TASKS_START = 1; // Start TIMER2
IRQ_CONNECT(TIMER2_IRQn, 7, TIMER2_IRQHandler, 0, 0);
}
K_SEM_DEFINE(dataReadyToBeSend, 0, 1);
ISR_DIRECT_DECLARE(TIMER2_IRQHandler) {
NRF_TIMER2->EVENTS_COMPARE[0] = 0; // Clear compare register 0 event
k_sem_give(&dataReadyToBeSend);
return 0;
}
K_THREAD_DEFINE(DataStreaming, 10240, Thread_DataStreaming, NULL, NULL, NULL, 3, 0, 0);
static void Thread_DataStreaming(void) {
while (1) {
int ret = k_sem_take(&dataReadyToBeSend, K_MSEC(100));
if ret == 0) {
bt_gatt_notify(NULL, &service.attrs[ATTR_DATA_INDEX], data, sizeof(data_t));
} else {/* .. */ }
}
}
BT_GATT_SERVICE_DEFINE(service,
BT_GATT_PRIMARY_SERVICE(&service),
BT_GATT_CHARACTERISTIC(
&dataCharacteristic.uuid,
BT_GATT_CHRC_NOTIFY,
BT_GATT_PERM_READ,
NULL, NULL,
&data),
BT_GATT_CCC(data_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
);
IRQ_CONNECT(TIMER2_IRQn, 7, TIMER2_IRQHandler, 0, 0);
You cannot use priority level 7, it translates to priority value of 0 in Zephyr. Do turn on CONFIG_ASSERT=y
to catch this at runtime.
Use a value of 5 if using Zero Latency Interrupts else you can use upto 6.
If this solves your issue, please remove the issue label "bug".
Dear @cvinayak and @carlescufi
Thank you for your quick support! Indeed changing the priority of the IRQ_CONNECT
to 5 solves this and all other instabilities I saw.
I will therefore close this issue.
Is there some further documentation about this? I had a look on IRQ_CONNECT as well as Interrupts but did not find anything related to this issue.
If this solves your issue, please remove the issue label "bug".
I have not the needed rights to do this.
Is there some further documentation about this? I had a look on IRQ_CONNECT as well as Interrupts but did not find anything related to this issue.
No, but feel free to submit a Pull Request, it would be much appreciated!
Describe the bug I am building a high througput application where we send notifications every few milliseconds. It is working as expected, how ever sporadically we get
I am aware of https://github.com/zephyrproject-rtos/zephyr/issues/21601 and added following lines to
proj.conf
:but without any visible improvement.
We also see same behaviour with
zephyr-2.4.0-rc2
and also with a revision back into July, so we don't think it is a recent regression.Is there any check we can do to avoid running into this assertion?