jgeisler0303 / CANFestivino

Arduino Library Version of CANFestival CANopen Stack
GNU Lesser General Public License v2.1
51 stars 17 forks source link

SYNC-Message not generated #14

Open tobhub93 opened 6 years ago

tobhub93 commented 6 years ago

Hi

I have implemented my node as a SYNC-Producer but it doesn't generate the corresponding messages. thats the part where the Sync is initalised:

`/ index 0x1005 : SYNC COB ID. / UNS16 ObjDict_obj1005 = 0x80; / 128 / ODCallback_t ObjDict_Index1005_callbacks[] = { NULL, }; subindex ObjDict_Index1005[] = { { RW, CANopen_TYPE_uint16, (void*)&ObjDict_obj1005 } };

/ index 0x1006 : Communication / Cycle Period. / UNS32 ObjDict_obj1006 = 0x2710; / 10000 / ODCallback_t ObjDict_Index1006_callbacks[] = { NULL, }; subindex ObjDict_Index1006[] = { { RW, CANopen_TYPE_uint32, (void*)&ObjDict_obj1006 } }; ` Does anybody has a advice?

thx

jgeisler0303 commented 6 years ago

I only ever used my PC as a sync producer and the node happily answered. It is very possible that I optimized the sync-producer capability away to fit the code in the restricted memory. But it's quite a while ago, so I don't really remember.

jgeisler0303 commented 6 years ago

It seems sync capability is there after all. Maybe you have to call startSYNC() once in your code or set the ObjDict_Index1006_callbacks to &OnCOB_ID_SyncUpdate. Not sure whats the right method. Maybe you can try?

tobhub93 commented 6 years ago

Hi Jens

Thanks for your help. Unfortunately it still does not work. I got this error message when I try to change the callbacks. Do you have found a solution? thx

jgeisler0303 commented 6 years ago

What error message? Did you forget to append it?

tobhub93 commented 6 years ago

You can see this error-message on the button of the attached screenshot.

What kind of Programm do you use on your PC to be the SYNC-Producer?

Thx for the help.

jgeisler0303 commented 6 years ago

I somehow cannot find any attachments.

For communication on the PC side (well really its a BananaPi with builtin CAN controller) I use this: https://github.com/jgeisler0303/can2mqtt

tobhub93 commented 5 years ago

Unfortunately, I'm still struggling with the same problem. My goal is to build a small network with 2 Arduino Uno. Sensor values are transmitted from the slave to the master via CANopen. The master should generate the cyclic SYNC message. But this is not the case. The code section below shows the implementation of the master as well as the corresponding object directory. For simplicity only with the SYNC function. Master.ino `

include "canfestival.h"

include "ObjDict.h"

// These all need to be included because canfestival needs them

include <avr/io.h>

include "Arduino.h"

include

include "mcp_can.h"

include "Timer.h"

include "digitalWriteFast.h"

include "BlinkPattern.h"

CO<3, 4> co; // template-Klasse erstellen

void setup() { Serial.begin(9600);

co.CO_Init(); // init CAN, setState(Initialisation), setAlarm()

analogReference(INTERNAL); startSYNC(); }

void loop() {

co.CO_Cycle();

} `

ObjDict header.txt ObjDict.txt

Does anyone have any idea why this isn't working?

thx