CANopenNode / CanOpenSTM32

CANopenNode on STM32 microcontrollers.
Other
275 stars 110 forks source link

SDO and NMT simulation #64

Open Chernobrovka opened 4 months ago

Chernobrovka commented 4 months ago

Is it possible to simulate the reception of nmt and sdo messages in CO Node using the functions: static void CO_NMT_receive(void object, void msg); static void CO_SDO_receive(void object, void msg); I'm trying to do it like this: if (tx_hdr.StdId == 0 && buffer->data[1] == CO_NODE_ID && buffer->DLC == 2){ CO_CANrxMsg_t rcvMsg; CO_CANrx_t nmt_command = CANModule_local->rxArray; memcpy(rcvMsg.data, buffer->data, NMT_LEN); rcvMsg.ident = 0; rcvMsg.dlc = NMT_LEN; nmtReceiveInterface(&nmt_command, &rcvMsg); } else if (tx_hdr.StdId == SDO_START_ADRESS + CO_NODE_ID){ CO_CANrxMsg_t rcvMsg; CO_CANrx_t sdo_command = CANModule_local->rxArray; memcpy(rcvMsg.data, buffer->data, SDO_LEN); rcvMsg.ident = tx_hdr.StdId; rcvMsg.dlc = SDO_LEN; sdoReceiveInterface(&sdo_command, &rcvMsg); } Will I be able to do this?