硬汉嵌入式论坛

 找回密码
 立即注册
查看: 781|回复: 4
收起左侧

[CAN/FDCAN] CanOpenNode 自带的read_SDO和writ_SDO找不到相关类型定义

[复制链接]

3

主题

6

回帖

15

积分

新手上路

积分
15
发表于 2025-1-7 10:22:47 | 显示全部楼层 |阅读模式
移植完成后 可以发送心跳 但在使用客户端read_SDO函数(在其他文件中定义)时 头文件中已经包含该CO_SDOclient_t定义的头文件 但还是报错 说CO_SDOclient_t未定义  不清除什么情况 希望有人提供一下思路 感谢
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117542
QQ
发表于 2025-1-7 11:45:59 | 显示全部楼层
看下分享的主从机例子,使用对比软件比较下配置选项,你这应该是有宏定义少使能了
回复

使用道具 举报

3

主题

6

回帖

15

积分

新手上路

积分
15
 楼主| 发表于 2025-1-7 14:03:19 | 显示全部楼层
eric2013 发表于 2025-1-7 11:45
看下分享的主从机例子,使用对比软件比较下配置选项,你这应该是有宏定义少使能了

佬,能给个链接吗?找了一圈没有找到
回复

使用道具 举报

3

主题

6

回帖

15

积分

新手上路

积分
15
 楼主| 发表于 2025-1-7 14:19:53 | 显示全部楼层
eric2013 发表于 2025-1-7 11:45
看下分享的主从机例子,使用对比软件比较下配置选项,你这应该是有宏定义少使能了

看了一下关于SDO的配置就这点了 也对比了一下是一样的
[C] 纯文本查看 复制代码
/**
 * @defgroup CO_STACK_CONFIG_SDO SDO server/client
 * Specified in standard CiA 301
 * @{
 */
/**
 * Configuration of @ref CO_SDOserver
 *
 * Possible flags, can be ORed:
 * - CO_CONFIG_SDO_SRV_SEGMENTED - Enable SDO server segmented transfer.
 * - CO_CONFIG_SDO_SRV_BLOCK - Enable SDO server block transfer. If set, then
 *   CO_CONFIG_SDO_SRV_SEGMENTED must also be set.
 * - #CO_CONFIG_FLAG_CALLBACK_PRE - Enable custom callback after preprocessing
 *   received SDO CAN message.
 *   Callback is configured by CO_SDOserver_initCallbackPre().
 * - #CO_CONFIG_FLAG_TIMERNEXT - Enable calculation of timerNext_us variable
 *   inside CO_SDOserver_process().
 * - #CO_CONFIG_FLAG_OD_DYNAMIC - Enable dynamic configuration of additional SDO
 *   servers (Writing to object 0x1201+ re-configures the additional server).
 */
#ifdef CO_DOXYGEN
#define CO_CONFIG_SDO_SRV (CO_CONFIG_SDO_SRV_SEGMENTED | CO_CONFIG_GLOBAL_FLAG_CALLBACK_PRE | CO_CONFIG_GLOBAL_FLAG_TIMERNEXT | CO_CONFIG_GLOBAL_FLAG_OD_DYNAMIC)
#endif
#define CO_CONFIG_SDO_SRV_SEGMENTED 0x02
#define CO_CONFIG_SDO_SRV_BLOCK 0x04

/**
 * Size of the internal data buffer for the SDO server.
 *
 * If size is less than size of some variables in Object Dictionary, then data
 * will be transferred to internal buffer in several segments. Minimum size is
 * 8 or 899 (127*7) for block transfer.
 */
#ifdef CO_DOXYGEN
#define CO_CONFIG_SDO_SRV_BUFFER_SIZE 32
#endif

/**
 * Configuration of @ref CO_SDOclient
 *
 * Possible flags, can be ORed:
 * - CO_CONFIG_SDO_CLI_ENABLE - Enable SDO client.
 * - CO_CONFIG_SDO_CLI_SEGMENTED - Enable SDO client segmented transfer.
 * - CO_CONFIG_SDO_CLI_BLOCK - Enable SDO client block transfer. If set, then
 *   CO_CONFIG_SDO_CLI_SEGMENTED, CO_CONFIG_FIFO_ALT_READ and
 *   CO_CONFIG_FIFO_CRC16_CCITT must also be set.
 * - CO_CONFIG_SDO_CLI_LOCAL - Enable local transfer, if Node-ID of the SDO
 *   server is the same as node-ID of the SDO client. (SDO client is the same
 *   device as SDO server.) Transfer data directly without communication on CAN.
 * - #CO_CONFIG_FLAG_CALLBACK_PRE - Enable custom callback after preprocessing
 *   received SDO CAN message.
 *   Callback is configured by CO_SDOclient_initCallbackPre().
 * - #CO_CONFIG_FLAG_TIMERNEXT - Enable calculation of timerNext_us variable
 *   inside CO_SDOclientDownloadInitiate(), CO_SDOclientDownload(),
 *   CO_SDOclientUploadInitiate(), CO_SDOclientUpload().
 * - #CO_CONFIG_FLAG_OD_DYNAMIC - Enable dynamic configuration of SDO clients
 *   (Writing to object 0x1280+ re-configures the client).
 */
#ifdef CO_DOXYGEN
#define CO_CONFIG_SDO_CLI (0)
#endif
#define CO_CONFIG_SDO_CLI_ENABLE 0x01
#define CO_CONFIG_SDO_CLI_SEGMENTED 0x02
#define CO_CONFIG_SDO_CLI_BLOCK 0x04
#define CO_CONFIG_SDO_CLI_LOCAL 0x08

/**
 * Size of the internal data buffer for the SDO client.
 *
 * Circular buffer is used for SDO communication. It can be read or written
 * between successive SDO calls. So size of the buffer can be lower than size of
 * the actual size of data transferred. If only segmented transfer is used, then
 * buffer size can be as low as 7 bytes, if data are read/written each cycle. If
 * block transfer is used, buffer size should be set to at least 1000 bytes, so
 * maximum blksize can be used (blksize is calculated from free buffer space).
 * Default value for block transfer is 1000, otherwise 32.
 */
#ifdef CO_DOXYGEN
#define CO_CONFIG_SDO_CLI_BUFFER_SIZE 32
#endif
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117542
QQ
发表于 2025-1-8 07:38:23 | 显示全部楼层
陌路 发表于 2025-1-7 14:03
佬,能给个链接吗?找了一圈没有找到

BSP视频教程第28期:CANopen协议栈专题,CANopen主从机组网实战,CAN词典工具使用方法以及吃透PDO玩法(2023-11-01)
https://forum.anfulai.cn/forum.php?mod=viewthread&tid=121619
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-8-13 18:32 , Processed in 0.041332 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表