Comments (4)
The standard says:
"The data of synchronous RPDOs received after the occurrence of the SYNC is passed to the
application with the occurrence of the following SYNC, independent of the transmission rate
specified by the transmission type. The data of event-driven RPDOs is passed directly to the
application."
Synchronous PDOs shall be transmitted inside sync window, otherwise they are ignored. They are passed to application immediately after the next SYNC message.
You can set RPDO to event driven (transmission type is 254 or 255), even if TPDO in transmitting device is set to synchronous. Or you can set synchronous windows.
However, this part is quite new and is not deeply tested.
from canopennode.
For this application, the sync window is disabled (OD_synchronousWindowLength=0), so I would expect a synchronous RPDO received a few milliseconds after a sync message to be processed on the following sync for any time interval, assuming no other RPDO arrives before the sync. (In this case, the sync interval is 30ms) However, CO_process_SYNC_RPDO calls CO_RPDO_process once per millisecond between syncs with syncWas=0. This clears the RPDO CANrxNew flag before the next sync, and the RPDO does not get passed to the application. If the RPDO happens to arrive in the millisecond before the sync, it does get passed to the application. RPDOs configured as event driven are always processed.
from canopennode.
The following code change in CO_PDO.c fixed the problem for me.
void CO_RPDO_process(CO_RPDO_t *RPDO, bool_t syncWas){
if(!RPDO->valid || !(*RPDO->operatingState == CO_NMT_OPERATIONAL))
{
RPDO->CANrxNew[0] = RPDO->CANrxNew[1] = false;
}
else if(!RPDO->synchronous || syncWas)
{
...
}
}
from canopennode.
I checked it and there was a bug (race conditions):
function CO_process_SYNC_RPDO() (from CANopen.c) calls CO_SYNC_process() and then calls CO_RPDO_process() for each RPDO. CAN messages are received from interrupt, which has higher priority than CO_process_SYNC_RPDO().
Following situation was problematic:
- CO_SYNC_process() was called, no SYNC detected.
- From CAN bus comes the train with SYNC and PDOs, which was immediately processed by CAN receive interrupt.
- CO_process_SYNC_RPDO() was interrupted in the middle and now continues with CO_RPDO_process() calls. In that case RPDOs were deleted.
Stack is now updated with the change from above. Operational RPDOs are not supposed to be deleted in any case. (CO_CANclearPendingSyncPDOs() only clears TPDOs outside window.)
Thank you.
from canopennode.
Related Issues (20)
- On STM32,Multiple TPDOs uses event-driven transmission, How to use the function "OD_requestTPDO(uint8_t *flagsPDO, uint8_t subIndex)" and "uint8_t *OD_getFlagsPDO(OD_entry_t *entry)" sends TPDO? HOT 2
- error handling on comms error HOT 2
- Open and close brackets mismatch in CO_Emergency.c HOT 1
- Send to different Nodes with same objects HOT 10
- How to handle SIGSEGV during the communication process to prevent program crashes HOT 4
- Configuring the micro as MASTER problem, CO_NMT_sendCommand() not defined HOT 1
- Multiple nodes, NMT problem HOT 2
- return CO_ERROR_OUT_OF_MEMORY HOT 1
- Questing about NMT and Heartbeat status queries HOT 1
- MISRA 2004 compliant for a few rules HOT 3
- Issue with include style fo Arduino HOT 4
- Porting SRDO to v4.0 HOT 4
- Trying to receive SDO messages in SDO client over the CO_SDOclient_receive HOT 5
- Unsigned int 24 bits HOT 5
- Enter the pre-oprational state HOT 5
- Please help HOT 3
- RPDO configuration every 2 Syncs HOT 1
- How to make it possible to receive all messages (SDO, PDO, NMT) in raw form? HOT 2
- Compiler warnings HOT 1
- Compiling without "CO_SINGLE_THREAD", using "1 w 0x1010 1 vs save" via ascii gateway causes deadlock (CO_LOCK_OD)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from canopennode.