Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDO: fix broken block download #210

Merged
merged 1 commit into from Jul 13, 2020

Conversation

lukegluke
Copy link
Contributor

@lukegluke lukegluke commented Jul 13, 2020

Fix wrong double calling CO_SDO_receive_done for last segment in subblock/block.

This is critical fix for PR #174
issue #39

Before this patch SDO block download was not working if there is no sequence breaks or timeouts (if SDO buffer not gets empty while receiving block). If data size is bigger or equal to blocksize, on receiving last segment, bug caused SDO to process wrong message buffer from FIFO while waiting block end sequence that leads to SDO abort 0504 0001h (client/server command specifier not valid or unknown).

It was caused by wrong double calling CO_SDO_receive_done on block end (one call in full buffer check and one in block end check) that broke FIFO receive pointer. Workaround was to set CO_SDO_BUFFER_SIZE greater than 127*7 (889 bytes) or work with CANopen master that always brake sequence on downloading :)

This fix preserve "old logic" we discuss in #205 issue.

Fix wrong double calling CO_SDO_receive_done for last segment in subblock/block.

This is critical fix for PR CANopenNode#174

issue CANopenNode#39
@lukegluke
Copy link
Contributor Author

It must be merged in old 1.3-master, but @CANopenNode it is up to you what to do with master, especially if you refactoring SDO. But take into account that current SDO block can't work at all for data longer than blksize.

@CANopenNode CANopenNode merged commit dd189cf into CANopenNode:v1.3-master Jul 13, 2020
CANopenNode added a commit that referenced this pull request Jul 13, 2020
by lukegluke, same as commit in v1.3-master
@CANopenNode
Copy link
Owner

I fixed the same also in master.

@lukegluke
Copy link
Contributor Author

Ok, thanks!

@lukegluke lukegluke deleted the sdo_fix branch July 13, 2020 14:16
henrikbrixandersen pushed a commit to vestas-wind-systems/CANopenNode that referenced this pull request Oct 19, 2021
Fix wrong double calling CO_SDO_receive_done for last segment in subblock/block.

This is critical fix for PR CANopenNode#174

issue CANopenNode#39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants