Code Monkey home page Code Monkey logo

Comments (2)

michael-hillmann avatar michael-hillmann commented on August 27, 2024

I guess you try to use the TPDO COBID macro for getting the standard connection set CO_COBID_TPDO_DEFAULT(0 .. 3)?

This is no limitation of the CANopen stack, this is just a common recommended set of COBIDs from the CiA standard.

Background: the CANopen standard defines a so-called "standard connection set", which includes 4 TPDOs. This is ok when we assume a network with 128 nodes. This leads us to the needed range of COBIDs: 4 TPDOs x 128 Nodes = 512 COBIDs used for TPDOs. For smaller networks (for example only 16 nodes with NodeId 1..16), we can place more TPDOs within each node: 512 COBIDs / 16 Nodes = 32 TPDOs per node. The reason is the limited number of COBIDs in a CANopen network.

Proposal:
You can create an application-specific (or better: network-specific) connection set. With the _BASE and _INC values you can tweak the COBIDs for your specific use-case:

#define MY_COBID_TPDO_BASE    (uint32_t)0x180
#define MY_COBID_TPDO_INC     (uint32_t)0x8     /* 8 Nodes with NodeId 1..8 */
#define MY_COBID_TPDO_SET(num)  \
    CO_COBID_TPDO_STD(1u, MY_COBID_TPDO_BASE + (num * MY_COBID_TPDO_INC))

Alternatively, you can simply set an individual set of COBIDs directly:

#define MY_TPDO1_COBID()   CO_COBID_TPDO_STD(1u, 0x200)   /* 7 Nodes with NodeId 10h, 20h, 30h, .., 70h */
#define MY_TPDO2_COBID()   CO_COBID_TPDO_STD(1u, 0x201)
#define MY_TPDO3_COBID()   CO_COBID_TPDO_STD(1u, 0x202)
  :
#define MY_TPDO16_COBID()   CO_COBID_TPDO_STD(1u, 0x20F)

Any scheme is possible.

Whichever method you use, to get the CANopen network working, you must ensure that no COBID is used multiple times. So it depends on the number of nodes, possible node-IDs, number of TPDOs, and the COBIDs of all other services.

from canopen-stack.

shersey-locus avatar shersey-locus commented on August 27, 2024

Thanks; that makes a great deal of sense. My network is quite small, so I can easily adjust the TPDO COBIDs to accomplish this.

from canopen-stack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.