Comments (4)
Hi, you are welcome to ask your questions at this place.
If I understand you right, you need a callback function that is called after a synchronized RPDO is processed?
Unfortunately, there is no callback today.
We could add a callback in file co_sync.c in function COSyncHandler().
May I ask, what you want to achieve with the callback function?
from canopen-stack.
Hi Michael,
Thanks for the quick reply. Yes as I understand it I'd like an application callback that occurs after a synchronized RPDO is processed and written to the OD. I see the COSyncHandler() function you mentioned and I imagine a callback would be fit right at the end of the function call and then need to be implemented by the user.
Regarding what I'm hoping to achieve, I'd like to allow my application firmware to be notified when the CANOpen master updates a value in the object dictionary via synchronized PDO (potentially the callback would just signal a semaphore, place a message in a queue, etc). This is my first application with CANOpen so maybe there's another way to achieve this. I dont believe polling the object dictionary would work as the master could send the same value via synchronized PDO and the node would still need to act on it (in our application).
from canopen-stack.
Ok, let us prepare a callback for the next version like:
for (i = 0; i < CO_RPDO_N; i++) {
if (sync->RPdo[i] != 0) {
CORPdoWrite(sync->RPdo[i], &sync->RFrm[i]);
COPdoSyncUpdate(sync->RPdo[i]); /* new callback */
}
}
With this enhancement, you can notify the RPDO identifier in a queue (or just set a semaphore). I think the CAN frame is not needed in this callback function, because we should always use the data out of the object dictionary. Will this change cover your needs?
from canopen-stack.
Hi Michael,
This sound like exactly what we need, thank you for the quick response and quick suggestion. I'll add your suggested changes locally and let you know if I have any issues, but I think it will work for our needs.
Agreed we should use the object dictionary data rather than the CAN frame directly here. Thanks again!
from canopen-stack.
Related Issues (20)
- generate source package with release v4.4.0
- quickstart is moved to own repository
- Not able to find object dictionary file in the stack and no idea which tool need to use to generate the EDS file HOT 4
- Implementation on TI C2000 MCU with 16-bit bytes HOT 6
- Variable Block Download block sizes HOT 3
- Failed to link files HOT 2
- DSP: Integer16 is not read as expected HOT 7
- reentering an abandoned segmented SDO session
- protocol boot-up spec possibly followed incorrectly HOT 1
- EMCY Service Err Index Size
- Bugfix for COSDO Segmented Download
- Size of buffer during NVM read
- Problems with RPDO dummy mapping - potential array out of bounds write HOT 2
- Linux port of the stack HOT 1
- COTPdoMapWrite: Add error checking to prevent uninitialized variable access.
- SDO timeout message after SDO request was successful
- How to tailor the lib to run on small-size MCU
- COTmrService stops all timers on failed CO_IF_CAN_DRV.Send?
- CAN communication stopped after creating CANOpen node.
- How to: master and more than default number of PDOs HOT 2
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 canopen-stack.