bug: tx_done and tx_bit_idx missing volatile qualifier #32

Closed
opened 2026-08-02 05:25:20 +00:00 by time · 1 comment
Contributor

tx_done is written in ISR and read in main, tx_bit_idx is written in main and read in ISR. Without volatile, compiler can cache these in registers, causing infinite loops in while(!tx_done) and stale reads in ISR. Fix: add volatile to both.

tx_done is written in ISR and read in main, tx_bit_idx is written in main and read in ISR. Without volatile, compiler can cache these in registers, causing infinite loops in while(!tx_done) and stale reads in ISR. Fix: add volatile to both.
Author
Contributor

Fixed in PR #39: tx_done and tx_bit_idx removed entirely. Replaced with single volatile uint8_t tx_tick flag set by ISR, read by main loop.

Fixed in PR #39: tx_done and tx_bit_idx removed entirely. Replaced with single volatile uint8_t tx_tick flag set by ISR, read by main loop.
time closed this issue 2026-08-03 04:06:57 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
daru/PICsense#32
No description provided.