[FIX] Fixed 2 bugs in the i210 driver #389
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed 2 bugs in the i210 driver causing all powerlink communication to stop.
Bug1:
The timer interrupt has 3 possible causes in the Powerlink driver (See i210 datasheet, chapter 8.16.1):
When ‘SYSTIM Warp around’ would occur at the same time as ‘Target Time 0/1 Trigger’, only ‘SYSTIM Warp around’ would be handled. The function would return, without handling the start of cycle. Without handling the start of cycle, all powerlink communication would stop.
This is fixed by ignoring the SYSTIM Warp around flag. Note that only disabling the SYSTIM interrupt would not fix the issue, because the flag would still be set.
Bug2:
Another error found was caused by 2 interrupt handlers reading and clearing the same registers.
This register is called EDRV_INTR_READ_REG in the driver, and IRC in the datasheet (See i210 datasheet, chapter 8.8.9). A read is performed on this register in the function: edrvTimerInterrupt and the function: edrvIrqHandler. Since this register is ‘Clear on read’, both interrupt functions being called at the same time causes problems.
To solve this error, the ‘SYSTIM Warp around’ interrupt is disabled in the function: edrv_startTimer. Since this interrupt is unused, it can be safely disabled.
The timer interrupt giving the start of cycle, and RX/TX interrupts should never happen at the same time in a Powerlink network. This interrupts don't need to be fixed.