1
0
Fork 0
This commit is contained in:
Janez 2020-09-29 10:13:53 +02:00
commit 3460e01e1c
6 changed files with 34 additions and 11 deletions

View file

@ -332,6 +332,7 @@ void CO_HBconsumer_process(
if (monitoredNode->HBstate == CO_HBconsumer_UNCONFIGURED) {
/* continue, if node is not monitored */
monitoredNode++;
continue;
}
/* Verify if received message is heartbeat or bootup */

View file

@ -889,7 +889,7 @@ uint8_t CO_TPDOisCOS(CO_TPDO_t *TPDO){
}
/******************************************************************************/
int16_t CO_TPDOsend(CO_TPDO_t *TPDO){
CO_ReturnError_t CO_TPDOsend(CO_TPDO_t *TPDO){
int16_t i;
uint8_t* pPDOdataByte;
uint8_t** ppODdataByte;

View file

@ -396,7 +396,7 @@ uint8_t CO_TPDOisCOS(CO_TPDO_t *TPDO);
*
* @return Same as CO_CANsend().
*/
int16_t CO_TPDOsend(CO_TPDO_t *TPDO);
CO_ReturnError_t CO_TPDOsend(CO_TPDO_t *TPDO);
/**

View file

@ -346,6 +346,14 @@ void CO_SYNC_initCallbackPre(
}
#endif
/******************************************************************************/
CO_ReturnError_t CO_SYNCsend(CO_SYNC_t *SYNC){
if(++SYNC->counter > SYNC->counterOverflowValue) SYNC->counter = 1;
SYNC->timer = 0;
SYNC->CANrxToggle = SYNC->CANrxToggle ? false : true;
SYNC->CANtxBuff->data[0] = SYNC->counter;
return CO_CANsend(SYNC->CANdevTx, SYNC->CANtxBuff);
}
/******************************************************************************/
CO_SYNC_status_t CO_SYNC_process(
@ -374,12 +382,8 @@ CO_SYNC_status_t CO_SYNC_process(
/* SYNC producer */
if(SYNC->isProducer && SYNC->periodTime){
if(SYNC->timer >= SYNC->periodTime){
if(++SYNC->counter > SYNC->counterOverflowValue) SYNC->counter = 1;
SYNC->timer = 0;
ret = CO_SYNC_RECEIVED;
SYNC->CANrxToggle = SYNC->CANrxToggle ? false : true;
SYNC->CANtxBuff->data[0] = SYNC->counter;
CO_CANsend(SYNC->CANdevTx, SYNC->CANtxBuff);
CO_SYNCsend(SYNC);
}
#if (CO_CONFIG_SYNC) & CO_CONFIG_FLAG_TIMERNEXT
/* Calculate when next SYNC needs to be sent */
@ -409,10 +413,13 @@ CO_SYNC_status_t CO_SYNC_process(
}
/* Verify timeout of SYNC */
if(SYNC->periodTime && *SYNC->operatingState == CO_NMT_OPERATIONAL) {
if(SYNC->periodTime && (*SYNC->operatingState == CO_NMT_OPERATIONAL || *SYNC->operatingState == CO_NMT_PRE_OPERATIONAL)){
if(SYNC->timer > SYNC->periodTimeoutTime) {
CO_errorReport(SYNC->em, CO_EM_SYNC_TIME_OUT, CO_EMC_COMMUNICATION, SYNC->timer);
}
else {
CO_errorReset(SYNC->em, CO_EM_SYNC_TIME_OUT, CO_EMC_COMMUNICATION);
}
#if (CO_CONFIG_SYNC) & CO_CONFIG_FLAG_TIMERNEXT
else if(timerNext_us != NULL) {
uint32_t diff = SYNC->periodTimeoutTime - SYNC->timer;

View file

@ -178,6 +178,21 @@ void CO_SYNC_initCallbackPre(
#endif
/**
* Send SYNC message.
*
* This function prepares and sends a SYNC object. The application should only
* call this if direct control of SYNC transmission is needed, otherwise use
* CO_SYNC_process().
*
*
* @param TPDO TPDO object.
*
* @return Same as CO_CANsend().
*/
CO_ReturnError_t CO_SYNCsend(CO_SYNC_t *SYNC);
/**
* Process SYNC communication.
*

View file

@ -48,12 +48,12 @@ Zephyr RTOS
* CANopenNode integration with Zephyr RTOS
* https://github.com/zephyrproject-rtos/zephyr/tree/master/subsys/canbus/canopen
* Example integration: https://docs.zephyrproject.org/latest/samples/subsys/canbus/canopen/README.html
* CANopenNode version:
* CANopenNode version: v1.3
* Status: stable
* Features: OD storage, LED indicators, SDO server demo for Zephyr RTOS
* Features: OD storage, LED indicators, Program Download, SDO server demo for Zephyr RTOS
* Development tools: Zephyr SDK
* Demo hardware: Any development board with CAN interface and Zephyr support (see https://docs.zephyrproject.org/latest/boards/index.html)
* Information updated 2020-01-21
* Information updated 2020-09-28
Mbed-os RTOS + STM32 (F091RC, L496ZG)