Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    KlausLionizers
    @KlausLionizers

    Hello, we are receiving the following failure very seldom on start of our application on a linux using socketcan. The application itself sets up the can device and then starts a thread that handles the canopen communication. Did you see anything similar?
    warning: error writing CAN frame: Operation canceled
    The device reports dropped tx frames in that case:

    3: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 128
        link/can  promiscuity 0
        can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
              bitrate 125000 sample-point 0.875
              tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
              flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
              clock 24000000
              re-started bus-errors arbit-lost error-warn error-pass bus-off
              0          0          0          12         13         0         numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
        RX: bytes  packets  errors  dropped overrun mcast
        15401      2956     0       0       0       0
        TX: bytes  packets  errors  dropped carrier collsns
        1466       185      0       12      0       0
    root@host:~# cat /sys/class/net/can1/operstate
    unknown

    Do you know if the state unknown is normal?

    2 replies
    Aaron Cofield
    @airfield20
    Is it possible to have 2 separate master applications running on the same bus, using lely? Ideally, I would like to have one application responsible for communicating with the motors through CANopen, and another application for communicating with the BMS through canopen.
    7 replies
    Connor Anderson
    @connoranderson:matrix.org
    [m]
    Are there any plans to get Debian installs of this library included in standard Linux apt repos?
    1 reply
    Johannes Bruder
    @jobrud_gitlab
    Good Morning, is there an example how to use SubmitRead() method ? I'm struggling how to provide the confirmation function parameter. I know it's due to my lack of cpp experience. I though I can do it with a lambda function something like:
        bool confirmation = false;
        SubmitRead<uint32_t>(0x2010, 1, [&](){ confirmation=true;});
    18 replies
    Connor Anderson
    @connoranderson:matrix.org
    [m]
    I’m working with a motor driver vendor that doesn’t support object 1016h so I need to use node guarding instead. I see some references to node guarding the codebase, but is this a supported feature? Do I need to implement my own timers & callbacks for this protocol?
    1 reply
    Tony Shu
    @tshu

    We're running into some slave boot failures when the communication cycle period is set too low. Our setup is a Verdin single board computer as a master for an Ingenia motor driver. Here is a post about our problem: https://toradex.com/community/questions/64991/extreme-can-framerate-limitations-transmit-queue-f.html?childToView=65033#comment-65033

    Essentially, is there any fault with Lely that would cause it to fail to boot a slave when the desired SYNC pulse frequency is too high?

    5 replies
    Corey Campbell
    @CoreyCampbellLumiradx
    Hello everyone! I was wondering if there were any plans to add a hirsute folder to the ubuntu ppa list (http://ppa.launchpad.net/lely/ppa/ubuntu/dists/). I'm, trying to install lely on ubuntu 21.04 using the instructions found here: https://opensource.lely.com/canopen/docs/installation/. Without this folder, the command "sudo add-apt-repository ppa:lely/ppa" doesn't work.
    2 replies
    Aaron Cofield
    @airfield20

    Hey all, Im using the can2udp tool to connect remotely to a can interface on a raspberry pi from my PC. However, I keep getting this error message on the pi device: can2udp: warning: received WTM abort code 02000002: Invalid sequence counter in generic frame

    Im not sure what this means and I could not find any meaningful documentation about it so far. Are there any resources for debugging this issue?

    3 replies
    KlausLionizers
    @KlausLionizers
    Hello everyone, I think we have a problem with SDO-Timeouts or rather with time-measurement? In a can-trace we see our generated SDO upload requests and the corresponding response but also an SDO Abort that we send. The response was within the defined timeout of the sdo service. This doesnt happen very often. Most of the time the SDO communication works. But we also had an event where we had several reported timeouts, but we couldnt create a trace yet on that kind of event. So maybe that is something different. Are we maybe missing some kind of synchronisation of the time? The system time is getting synced using NTP. We use clock_monotonic for the io_timer. We only use the c-library, not the coapp lib.
    Thanks for any help
    7 replies
    EStrehlau
    @EStrehlau
    Hi everyone, I was finally able to track down the timeout issues my colleague was having.
    It appears to be that case that io_can_net_set_time only gets called after setting the timeout for the new sdo upload request. In effect this uses the last time from last time io_can_net_set_time was called. If the timeout is smaller than that amout it imediatly trips before even reading the SDO response:
    Thread 2 "" hit Breakpoint 33, co_csdo_up_req (sdo=0xa1c094f0, idx=24368, subidx=48 '0', con=0x4e7345 <SdoUploadFinishedCallback>, data=0xa2c03e6c) at ../../../git/src/co/csdo.c:1292
    1292    {
    (gdb) 
    Continuing.
    
    Thread 2 "" hit Breakpoint 24, can_timer_timeout (timer=0xa32110d0, net=0xa4601640, timeout=1000) at ../../../git/src/can/net.c:497
    497            can_timer_start(timer, net, &start, NULL);
    $72 = {tv_sec = 11240, tv_nsec = 314321950}
    
    Thread 2 "" hit Breakpoint 34, co_csdo_send_up_ini_req (sdo=0xa1c094f0) at ../../../git/src/co/csdo.c:2442
    2442        co_csdo_init_ini_req(sdo, &msg, cs);
    
    Thread 2 "" hit Breakpoint 21, io_can_net_set_time (net=net@entry=0xa3803080) at ../../../git/src/io2/can_net.c:689
    689        return can_net_set_time(io_can_net_get_net(net), &now);
    $73 = {tv_sec = 11279, tv_nsec = 657772724}
    
    Thread 2 "" hit Breakpoint 29, co_csdo_timer (tp=0xa460164c, data=0xa1c094f0) at ../../../git/src/co/csdo.c:1509
    1509        assert(tp);
    $74 = {tv_sec = 11279, tv_nsec = 657772724}
    
    Thread 2 "" hit Breakpoint 31, 0xa670dd1e in co_csdo_abort_res (ac=<optimized out>, sdo=<optimized out>) at ../../../git/src/co/csdo.c:1650
    1650        return co_csdo_abort_res(sdo, CO_SDO_AC_TIMEOUT);
    2 replies
    Johannes Bruder
    @jobrud_gitlab
    The build on my developer machine is now failing ( git tag v2.3.0). Notice that someone else ?
    6 replies
    Ryan
    @Ryan-Red
    Hello, I was just wondering if anyone has any resources other than the one C++ example code; I am trying to send messages to a motor driver to make a motor turn but am constantly getting the following error: Object cannot be mapped to the PDO (06040041). Any help is appreciated as I had to take over a code base using canOpen and am not receiving any replies from the author.
    6 replies
    Licht_Qiang
    @Licht-fight
    Hallo Mr. Seldenthuis
    I try to understand NMT, and i found that Heartbeat procedure belongs to NMT also, but somes said Heartbeat also belongs to SDO. I'm quite confused about it.
    Could you also give a example how can i configure Heartbeat with NMT? because i just found the Heatbeat answer but i did't find the Heartbeat configure.
    Thanks!
    3 replies
    Ryan
    @Ryan-Red
    I was also wondering, in the tutorial code we have a polling loop, which we run using loop.run(), how exactly do we send messages to our can device if this polling is running? My first instinct was to run the loop.run() in a separate thread from my message-sending thread, but is there a better and more elegant way of doing things? Thanks!
    2 replies
    Ladislav Sládeček
    @sladecek
    Hi, I am looking at the C++ tutorial and I am curious if there is a function similar to 'OnRpdoWrite' which gets called when any RPDO is received regardless of any mappings. Thanks.
    2 replies
    Connor Anderson
    @connoranderson:matrix.org
    [m]
    Question, we have a bunch of sensors on our bus which are getting configured via sdo at boot. We are using the master to boot all of them, and there is an issue where too much traffic seems to be hitting right at the beginning of config. Is there any way to space out the configuration window to make there be less instantaneous traffic on the bus?
    I realize I could do this by not having the master boot and then building my own boot sequence in a separate thread, just wanted to see if there are any “built in” approaches
    2 replies
    andretoshioueno
    @andretoshioueno
    Hi, I am still learning CANopen and just finished the C++ tutorial but I still don't understand how to extend the tutorial to create my slave node. Don't know if this question makes sense but here it goes:
    Suppose that I wanted to create a slave node to monitor a few inputs. The inputs state would be sent on a TPDO and I would prefer to have transmission type set to change of state.
    In that case I could create a different thread to monitor the inputs, but how can I send this information to the CANopen thread? Once the slave code reaches "loop.run()" it will be waiting for events to arrive, so I don't see how to signal the canopen thread that an input change ocurred.
    Hope it makes sense :)
    andretoshioueno
    @andretoshioueno

    Hi, I am still learning CANopen and just finished the C++ tutorial but I still don't understand how to extend the tutorial to create my slave node. Don't know if this question makes sense but here it goes:
    Suppose that I wanted to create a slave node to monitor a few inputs. The inputs state would be sent on a TPDO and I would prefer to have transmission type set to change of state.
    In that case I could create a different thread to monitor the inputs, but how can I send this information to the CANopen thread? Once the slave code reaches "loop.run()" it will be waiting for events to arrive, so I don't see how to signal the canopen thread that an input change ocurred.
    Hope it makes sense :)

    Just read Ryan's question and I think I understand the approach now. I will try the answer suggested.
    Thanks

    Ladislav Sládeček
    @sladecek
    Hi. What is the best way how to implement a periodic timer (for example with 5ms period) using the 'lely/coapp' class interface? I have found c C interface for timer in the io2 module but I wonder if there is a C++ solution.
    2 replies
    Kai Franke
    @kalectro
    Hello, we are considering using this beautiful library, but there is one thing that is not clear to us about how best to implement it. We would like to send out a message when a list of objects has been received through RPDOs. To do this we override OnRpdoWrite() and log which object was received. When all objects have been received, we would publish the message. The thing we were wondering is if this is a good solution or if there is something prettier.
    1 reply
    Francois Vienne
    @fvienne_gitlab
    Hi all, I would like to use the Lely CANopen lib in my SW. In my CAN bus, I have unit which are CANopen compatible and some which are not compatible. Does someone know if the Lely lib operate those unit which aren't CANopen compatible or I need to have another lib? Many thanks for your answer.
    4 replies
    Connor Anderson
    @connoranderson:matrix.org
    [m]

    Has anyone seen an issue where the master node tries to check the VendorId (object 1018 sub 1) and receives an abort code 08000000? I'm not seeing this content being sent from the slave device, so it seems that the master has some issue where it doesn't have enough resources to complete the request (cpu usage very high at the moment this happens). I'm surprised it's not an SDO timeout instead of a general error if that was the case. We're running on an embedded, low-power CPU.

    error: SDO abort code 08000000 received on upload request of sub-object 1018:01 (Vendor-ID) to node 09: General error
    slave 9 failed to boot: Value of object 1018 sub-index 01 from CANopen device is different to value in object 1F85 (Vendor-ID).

    The slave, however, responded with the correct Vendor-Id in its SDO response

    (1630375454.640773) can1 609#4018100100000000
    (1630375454.641287) can1 589#43181001A3010000  # this is the correct vendor-id
    3 replies
    Pavel Ko.
    @justason
    Hello, I'm trying to make a CANOpen slave that is implementing Heartbeat Consumer functionality. The CANOpen master is sending every 500ms a heartbeat message [0x704 05] and when it stops, the slave shall go to the pre-op state.
    The objects 1016 and 1017 are configured as follows:

    [1016sub0]
    ParameterName=max sub-index
    ObjectType=0x7
    DataType=0x0005
    AccessType=ro
    DefaultValue=1
    PDOMapping=0

    [1016sub1]
    ParameterName=Consumer heartbeat time
    ObjectType=0x7
    DataType=0x0007
    AccessType=rw
    DefaultValue=1250
    PDOMapping=0

    [1017]
    ParameterName=Producer Heartbeat Time
    ObjectType=0x7
    DataType=0x0006
    AccessType=rw
    DefaultValue=500
    PDOMapping=0

    However, when I'm stopping the master, the slave persists in operable mode 0x05. I'm working out the basic c++ tutorial slave example.
    Pavel Ko.
    @justason
    The candump log looks like:

    <0x704> [1] 05

    <0x704> [1] 05

    <0x704> [1] 05

    <0x70a> [1] 00

    <0x70a> [1] 7f

    <0x704> [1] 05

    <0x70a> [1] 7f

    <0x704> [1] 05

    <0x70a> [1] 7f

    <0x000> [2] 01 00

    <0x704> [1] 05

    <0x70a> [1] 05

    <0x704> [1] 05 ; Stopping master here

    <0x70a> [1] 05

    <0x70a> [1] 05

    <0x70a> [1] 05

    <0x70a> [1] 05

    <0x70a> [1] 05

    <0x70a> [1] 05

    <0x70a> [1] 05

    <0x70a> [1] 05

    <0x70a> [1] 05

    <0x70a> [1] 05
    ...

    Pavel Ko.
    @justason
    So the question: Why the EDS configuration insufficient and what is missing?
    Pavel Ko.
    @justason
    I'm sorry for disturbing the conversation. I have found the answer myself: The Heartbeat consumer default value on subnode1 shall have coustructed as such:
    ;Bit 31 (MSB) to 24 23 to 16 15 to 0 (LSB)
    ;Value 0h (Reserved) Address of monitored CANopen master Monitoring time (ms)
    So the actual value for 1250ms will be: DefaultValue=0x000404E2
    yiqiang zhang
    @zhangyiqiang2016_gitlab

    @jseldent_gitlab Hallo Mr. J.S. when i try to compile the slave.cpp, it shows

    error: ‘can_net’ does not name a type; did you mean ‘io_can_net’?
    480 |
    can_net* net() const noexcept;
    | ^~~~~
    | io_can_net

    i used the Lely library several months ago, and there was no problem. Am I getting this error now because i need run this code <pkg-config --cflags liblely-coapp> ?
    But when i do this, it shows:

    Package 'liblely-co' requires 'liblely-libc >= 2.3.0' but version of liblely-libc is 2.2.5
    You may find new versions of liblely-libc at https://gitlab.com/lely_industries/lely-core

    And i tried to install the new Lely core libraries, but it shows:

    usr/bin/install: cannot create directory ‘/usr/local/share/doc’: Permission denied
    /usr/bin/install: failed to access '/usr/local/share/doc/lely-core/html': No such file or directory
    make[2]: [Makefile:537: install-html-local] Error 1
    make[2]: Leaving directory '/home/yq/Desktop/Lelycore/lely-core/doc'
    make[1]:
    [Makefile:393: install-am] Error 2
    make[1]: Leaving directory '/home/yq/Desktop/Lelycore/lely-core/doc'
    make: * [Makefile:472: install-recursive] Error 1

    Can you help me in this point?
    Thank you very much!

    1 reply
    Pavel Ko.
    @justason

    Hello, could you please help me to setup Asynchronous TPDO.

    I have configured TPDO communication parameter as follows:
    asynchronous: transmission type=255
    Inhibit time: 25ms: DefaultValue=0xFA
    event Timer 1000ms: DefaultValue=1000

    The idea is to send TPDO every 1000ms when there was no value changes.
    And when change has happened - send TPDO after inhibit time: 25ms.

    https://pastebin.com/FWWsvvKm

    The current setup just sends the TPDO every 1000ms.

    When I set Event timer value to 0, it stops to send TPDO at all.

    When I set Event timer value to 1, and inhibit timer to 25ms - the application starts to send TPDO every 25ms,
    regardless where the data changed or not.

    11 replies
    Pavel Ko.
    @justason
    image.png
    GPenzo
    @gpenzo_gitlab
    Hello, Is there a method to know when a device goes offline, disconnected or stop working?
    3 replies
    Johannes Bruder
    @jobrud_gitlab

    Hi, we observing randomly can issues and we see the following error message:

    Sep 08 12:02:52 colibri-imx6ull copsman[240]: error writing CAN frame: Operation canceled
    Sep 08 12:02:52 colibri-imx6ull copsman[240]: CAN frame successfully written after 125 write errors

    When the error occurs its always after 125 write errors again successfully. I'm wondering why its 125. Do you have any idea ?

    14 replies
    Ryan Spicer
    @alterscape
    Apologies if this is not in the spirit of the room, but: I have a CAN device that I do not have a dcf (or any other documentation) for, acquired via ebay. I am fairly sure (but not certain) it implements CANOpen. Is it possible to attempt to dump the current configuration via coctl/etc, to get a better idea what I have?
    1 reply
    GPenzo
    @gpenzo_gitlab
    Hello Jos. Can we use the IsReady function to know that a node is up and ready to be used. Also if the node is not operational anymore or the master does not recive a heartbeat will the IsReady be false?
    6 replies
    Licht_Qiang
    @Licht-fight
    @jseldent_gitlab Hello Mr. Seldenthuis, are you familiar with the interpolated position mode in dsp402? I have some questions about it and wanted to ask if you would be able to help me
    1 reply
    Perse make
    @heken2222_gitlab
    Hello, I am trying to compile lely-core lib on Alpine which has musl-libc ( planning to run a canopen node in docker container, I am using alpine for size mainly) . Have anyone managed to get musl based builds working? It seems that the macro definitions assume glibc on linux and it seems that achieving musl compatibility would be quite a chore, re-definiton errors, not defined errors etc. everywhere.. Any pointers?
    3 replies
    Val Krutov
    @Kurvatis_gitlab

    Hello, I use new operator to create dynamically allocated drivers for slaves. On ctrl+C it does "Segmentation fault", which possible to avoid by removing either delete operator or master.AsyncDeconfig(). It does not look like FiberDriver has a virtual destructor because the destructor of MyDriver does not get called on delete in fnExit(), but makes the fault. How can it be avoided?

    MyDriver * slave[127];
    
    void fnExit(void) {
      for ( int i=0; i<127; i++ ) {
        if ( id[i] ) {        
          delete slave[i];
        }
      }
    }
    
    int main(int argc, char **argv) {
    
      atexit (fnExit);
    ...
      for ( int i=0; i<127; i++ ) {
        if ( id[i] ) { 
          slave[i] = new MyDriver(exec, master, id);
        } 
      }
    ...
      master.AsyncDeconfig().submit(exec, [&]() {
       // Perform a clean shutdown.
       ctx.shutdown();
      });
    ...
    }

    Thanks!

    1 reply
    Val Krutov
    @Kurvatis_gitlab

    It seems that if add one extra driver allocated in stack before the for loop then it is working...

      MyDriver slave_fixer(exec, master, 99); //< fixer, node 99 does not exist
      for ( int i=0; i<127; i++ ) {
        if ( id[i] ) { 
          slave[i] = new MyDriver(exec, master, id);
        } 
      }

    Also it sends the following message:

    terminate called after throwing an instance of 'std::system_error'
      what():  USleep: Operation canceled
    Aborted

    Is it expected?

    Thanks!

    6 replies
    Val Krutov
    @Kurvatis_gitlab

    Hello. I need the TIME service to be represented in master (to make it as a time producer) no matter what slaves have. So, I did modified master.dcf.em file. I added in the script the object "5=0x1012" and its description [1012]. Now dcfgen always generates master.dcf with TIME service.

    Is it legal? Can I give it to customers? Do I need to mention this on licenses? Is there other or better way to force the dcfgen creates TIME Service?

    ...
    [OptionalObjects]
    SupportedObjects=@(6 + master.heartbeat_consumer + 5 + 2 * nrpdo + 2 * ntpdo + configuration_update + 2 + software_update + 10)
    1=0x1003
    2=0x1005
    3=0x1006
    4=0x1007
    5=0x1012 <<<<<<
    6=0x1014
    7=0x1015
    @{n = 7}@
    ...
    [1012]
    ParameterName=COB-ID TIME
    DataType=0x0007
    AccessType=rw
    DefaultValue=0x40000100

    Thanks!

    2 replies
    Connor Anderson
    @connoranderson:matrix.org
    [m]
    Hi all, somewhat basic question here. I'm trying to use the CanChannel object to read every message off a socketcan bus and pass them to a callback. I'm wondering what the correct way is to implement the "loop.run" and "chan.read" sequence? Right now I am using "loop.run_once_for(1ms)" followed by a sychronous read which is working well for low bus loads but struggles when the bus is fully loaded. I think it has to do with the 1ms loop rate but not sure. Thanks!
    5 replies
    Daniel Masarin
    @daniel.masarin_gitlab
    Hello, I started an issue two days ago about the DCF-to-C tool. But what I really need is an option to create the object dictionary at runtime. That is because I'm using a file abstraction (like the dcfgen tool) to configure the device. One option I have is to use the information from that abstraction to generate an DCF file, but I'll need to write that logic and it's a waste of processing. I'll be a lot better to input that configuration directly using some object structure and input it to the library. Are there a way to do that? Or some planning to implement that issue?
    5 replies
    csavorgn
    @csavorgn
    Hello, I'm working on the implementation of a slave on a STM32 F4 microcontroller and I'm using the C API. I have working NMT and SDO but I'm having troubles making PDOs work. Is there any example code I can use to check if forgot something?
    1 reply
    jemeador
    @jemeador:matrix.org
    [m]
    Hello! Does anyone have an example that uses the LoopDriver instead of the FiberDriver? I'm trying to track down a deadlock (warned about here https://opensource.lely.com/canopen/docs/cpp-tutorial/#configuring-a-slave).
    4 replies
    jemeador
    @jemeador:matrix.org
    [m]
        ev_loop_thread_ = std::thread([&]() {
          driver_ = std::make_shared<D>(master_, can_addr);
          master_.Reset();
          loop_.run();
        });
    and later this is invoked from the main thread and causes a deadlock
      template <typename T>
      void RunRead(const uint16_t idx, const uint8_t subidx, T& value) {
        // GDB shows this call is blocked indefinitely in a loop wait
        value = driver_->template RunRead<T>(idx, subidx);
      }
    jemeador
    @jemeador:matrix.org
    [m]
    this succeeds for some time before it locks up
    1 reply