Comments (2)
Hello! Our device has a high requirement for real-time performance and cannot be blocked for too long, so I have the same concern. Currently, my approach is to have the caller poll this function multiple times until it returns either success or failure before exiting.
extern SdoAbortCode writeSdoClientNoBlock(uint8_t nodeId, uint16_t index, \
uint8_t subIndex, uint8_t* data,\
size_t dataSize)
{
static uint8_t first_entry = 0;
static bool_t bufferPartial = false;
CO_SDO_return_t SDO_ret;
CO_SDOclient_t* SDO_C = CO->SDOclient;
if (first_entry == 0)
{
first_entry = 1;
// setup client (this can be skipped, if remote device is the same)
SDO_ret = CO_SDOclient_setup(SDO_C,
CO_CAN_ID_SDO_CLI + nodeId,
CO_CAN_ID_SDO_SRV + nodeId,
nodeId);
if (SDO_ret != CO_SDO_RT_ok_communicationEnd)
{
return USER_ERR_CODE;
}
// initiate download
SDO_ret = CO_SDOclientDownloadInitiate(SDO_C, index, subIndex,
dataSize, 1000, false);
if (SDO_ret != CO_SDO_RT_ok_communicationEnd)
{
return USER_ERR_CODE;
}
// fill data
size_t nWritten = CO_SDOclientDownloadBufWrite(SDO_C, data, dataSize);
if (nWritten < dataSize)
{
bufferPartial = true;
// If SDO Fifo buffer is too small, data can be refilled in the loop.
}
}
//download data
CO_SDO_abortCode_t abortCode = CO_SDO_AB_NONE;
uint32_t timeDifference_us = 1000;
SDO_ret = CO_SDOclientDownload(SDO_C,
timeDifference_us,
false,
bufferPartial,
&abortCode,
NULL, NULL);
if (SDO_ret == 0) //success
{
first_entry = 0;
bufferPartial = false;
return REDEF_CO_SDO_AB_NONE;
}
else if (SDO_ret > 0)
{
return SDO_NO_BLOCK_WAIT_CODE;//Self-defined return values
}
else
{
first_entry = 0;
bufferPartial = false;
return (SdoAbortCode)abortCode;
}
}
from canopennode.
SDO client is quite complex and has to be implemented properly and well integrated into OS. In CANopenLinux it works really fast, no delays, very reliable. See there and also CANopenDemo.
from canopennode.
Related Issues (20)
- Example to exclude OD.h from CANopen.c HOT 3
- Increment user data pointer for all callbacks HOT 1
- CO_SDOclientDownload in the v1.3-master branch has an overflow issue during segment downloads HOT 1
- Wrong TPDO initialization sequence in case of dynamic OD HOT 2
- How to port CANopenNodel to TMS320F28375D HOT 3
- LSS Identify Remote Slave function? HOT 5
- TIME protocol not sending trace at interval HOT 3
- receive sdo excute then response sdo HOT 4
- Dynamic Manufacturer-specific Object creation HOT 2
- SDO fails with message flood HOT 1
- On STM32,Multiple TPDOsTPDO uses event-driven transmission, how to send it?How should this "CO_TPDO_process" function be used?
- 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
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.