1
0
Fork 0
Commit graph

147 commits

Author SHA1 Message Date
Janez
9b8beed836 Better organize CO_EM_RPDO_TIME_OUT detection. #618, #626
Move RPDO related code from CANopen.c into PDO.c, remove additional for loop.
Introduce new optional argument bool_t* timeoutState into CO_RPDO_process().
2026-07-10 16:17:46 +02:00
Frab012
5a97d2d209 Add missing RPDO timeout error handling in LED processing 2026-07-10 08:25:16 +02:00
Tristen Pierson
a36ab57e4e fix: CO_EM_RPDO_TIME_OUT incorrectly cleared when multiple RPDOs monitored
CO_EM_RPDO_TIME_OUT is a single shared error bit for all RPDO instances.
CO_RPDO_process() called CO_errorReset() for this bit the moment any one
RPDO recovered from timeout, even if other RPDOs were still timed out.

Scenario that exposes the bug:
  node-2 and node-3 are RPDO producers with deadline monitoring.
  Both go pre-operational -> CO_EM_RPDO_TIME_OUT set -> error register 0x10.
  node-2 comes back -> CO_RPDO_process() calls CO_errorReset() ->
  CO_EM_RPDO_TIME_OUT cleared -> error register 0x00.
  node-3 is still timed out: the error register is now incorrect.

Fix: remove CO_errorReset() from CO_RPDO_process(). Instead, add a
post-loop check in CO_process_RPDO() (CANopen.c) that iterates all RPDO
instances. CO_errorReset() is only called when none of them remains in
timeout (timeoutTimer > timeoutTime_us). CO_process_RPDO() has access
to the full co->RPDO[] array and is therefore the correct place to make
this cross-RPDO decision. CO_errorReset() is a no-op when the error bit
is already clear, so calling it every cycle when no timeout is active is
safe and efficient.
2026-07-10 08:20:05 +02:00
Janez
8c09a433ef Fix CANopen terminology: “CAN messages” are actually “CAN frames”
Fix all documentation and comments according to CiA proposals:
https://www.can-cia.org/services/publications/can-community-news/05-2025

CANopenNode was using "CAN message" in many places, but actually such
term is incorrect. No code or variable names was changed.
2026-06-26 10:23:01 +02:00
Janez
145a15d944
Update CANopen.c (#577), Issue #576 2025-05-07 09:39:51 +02:00
Janez
82c95a2bc9 Format comments in the .c files. 2024-07-06 21:48:21 +02:00
Janez
95c1705e76 Format the .c files using clang-format v15. 2024-07-06 19:57:06 +02:00
Janez
f064eeaa40 Format the license information in files. 2024-07-06 13:03:00 +02:00
temi54c1l8
28d3c1f372 Fix SRDO problem with PCL Codesys on configuration runtime without reset 2024-07-04 09:55:39 +02:00
temi54c1l8
dad273b656 CANopen: static analysis: expected end of line in preprocessor expression 2024-06-27 14:26:09 +02:00
temi54c1l8
b17182d962 CANopen: static analysis: an unsigned value and a signed value cannot be used together as operands [MISRA 2012 Rule 10.4, required] 2024-06-27 14:21:22 +02:00
temi54c1l8
823dcb3427 CANopen: static analysis: essential type of condition of 'if' statement is 'enum (CO_ReturnError_t)' but should be boolean [MISRA 2012 Rule 14.4, required] 2024-06-27 13:09:48 +02:00
temi54c1l8
d4c69b2ca4 CANopen: staatic analysis: an unsigned value and a signed value cannot be used together as operands to == [MISRA 2012 Rule 10.4, required] 2024-06-27 13:07:55 +02:00
temi54c1l8
ff3299918e CANopen: static analysis: increment/decrement operation combined with other operation with side-effects [MISRA 2012 Rule 13.3, advisory] 2024-06-27 13:06:39 +02:00
temi54c1l8
f6a4718428 CANopen: static analysis: an unsigned value and a signed value cannot be used together as operands to > [MISRA 2012 Rule 10.4, required] 2024-06-27 13:05:00 +02:00
temi54c1l8
926dc62873 CANopen: static analysis: side effects on right hand of logical operator, '||' [MISRA 2012 Rule 13.5, required] 2024-06-12 16:43:51 +02:00
temi54c1l8
4cee088192 CANopen: static analysis: named parameter 'OD_statusBits' of 'non-virtual' function 'CO_CANopenInit' not subsequently referenced [MISRA 2012 Rule 2.7, advisory] 2024-06-12 16:36:20 +02:00
temi54c1l8
308f32ee8b CANopen: static analysis: both sides have side effects [MISRA 2012 Rule 1.3, required] 2024-06-12 16:34:56 +02:00
temi54c1l8
24065d5751 CANopen: static analysis: cannot assign 'unsigned16' to narrower essential type 'unsigned8' [MISRA 2012 Rule 10.3, required] 2024-06-12 16:29:47 +02:00
temi54c1l8
0f06b1022d CANopen:static analysis: right operand to + is a composite expression of type 'unsigned8' which is smaller than the left operand of type 'unsigned16' [MISRA 2012 Rule 10.7, required] 2024-06-12 16:23:04 +02:00
temi54c1l8
704bc17b1e CANopen:static analysis possible loss of precision (assignment) 2024-06-12 15:15:02 +02:00
temi54c1l8
8c06bec4c9 CANopen: static analysis increment operation combined with other operation with side-effects [MISRA 2012 Rule 13.3, advisory] 2024-06-12 15:08:54 +02:00
temi54c1l8
73a65dbfea Revert "CANopen: static analysis: locals not referenced [MISRA 2012 Rule 2.5, advisory]"
This reverts commit 20fa24abf7.
2024-06-12 14:59:34 +02:00
temi54c1l8
20fa24abf7 CANopen: static analysis: locals not referenced [MISRA 2012 Rule 2.5, advisory] 2024-06-12 14:57:53 +02:00
temi54c1l8
cff7a3cf5a static analysis: refactoring changed enum with define to be able to use bitwise operators on user space 2024-06-12 14:35:37 +02:00
temi54c1l8
686ab04ee9 static analysis: enumerator 'CO_CAN_ID_EMERGENCY' reuses the constant value '128' previously used by enumerator 'CO_CAN_ID_SYNC'
refactoring changed enum with define
2024-06-12 14:26:51 +02:00
temi54c1l8
691728f71a static analysis: essential type of condition of 'if' statement is in not correct [MISRA 2012 Rule 14.4, required] 2024-06-12 13:57:42 +02:00
temi54c1l8
7855d35bae static analysis: refactoring changed enum with define to be able to use bitwise operators 2024-06-12 13:41:13 +02:00
temi54c1l8
6e009c0893 static analysis: cannot assign 'signed8' to different essential type 'boolean' [MISRA 2012 Rule 10.3, required] 2024-06-12 10:42:40 +02:00
temi54c1l8
9e8ceb4dfa static analysis: ignoring return value of functions [MISRA 2012 Directive 4.7, required] 2024-06-12 10:13:45 +02:00
temi54c1l8
d4e7214f4d static analysis: conditional of #if does not evaluate to 0 or 1 [MISRA 2012 Rule 20.8, required] 2024-06-12 09:09:12 +02:00
temi54c1l8
88e437b525 static analysis: minor fix 2024-06-11 09:14:58 +02:00
temi54c1l8
0142f41857 static analysis: an enum value is not an appropriate left operand [MISRA 2012 Rule 10.1, required] 2024-06-10 17:59:05 +02:00
temi54c1l8
446925be63 static analysis: add 'U' of unsigned [MISRA 2012 Rule 10.4, required] 2024-06-10 17:57:42 +02:00
temi54c1l8
c8f161cb42 fix variable lowestState assignment 2024-06-03 10:27:09 +02:00
Janez
f054501d0e SRDO updated to current CANopenNode 2024-05-31 01:47:28 +02:00
temi54c1l8
f96ffb2526
Porting SRDO to v4.0 (#505)
* Renamed structure from CO_SDO_t to CO_SDOserver_t

* Porting SRDOGuard

* Porting SRDO

* Porting SRDO on CANopen.c with new parameters

* Misra for SRDO

* Fix extension read and write control count

* Remove pointer to configurationValid and CRC and connect to OD

* Remove dependencies from CO_SDOserver.h and CO_NMT_Heartbeat.h

* Replaced  CO_driver.h with CO_ODinterface.h
2024-04-09 11:56:43 +02:00
Brian Linari
a52db428f6
Misra (#501)
Make MISRA compliant for:
MISRA C 2004 rule 14.10
MISRA C 2004 rule 14.9
MISRA C 2004 rule 13.1
MISRA C 2004 rule 15.3

MISRA style guild update
2024-03-13 17:20:42 +01:00
Janez
a4b4e6df66 Node guarding disable, if heartbeat is used. 2023-10-19 12:16:37 +02:00
Janez
b0b0724c6f Node guarding added 2023-09-07 16:58:04 +02:00
Tilen Majerle
9c146e8b91 Replace malloc/free with CO_ and add macro for complete allocation 2021-08-26 13:25:38 +02:00
Janez
b1b091a463 Add option for logical devices to have more than four PDOS with pre-defined CAN_IDs. 2021-08-10 16:34:20 +02:00
Janez
b9927ff1cd Remove CO_CONFIG_EM_BUFFER_SIZE macro, size is fetched from Object Dictionary
It is necessary to re-generate OD.h file with the latest CANopenEditor
from https://github.com/CANopenNode/CANopenEditor
2021-06-28 12:39:03 +02:00
Janez
b8b9011f7f Remove CO_CONFIG_HB_CONS_SIZE macro, size is fetched from Object Dictionary
It is necessary to re-generate OD.h file with the latest CANopenEditor
from https://github.com/CANopenNode/CANopenEditor
2021-06-26 13:53:49 +02:00
Janez
cdad71beee Fix reading OD entry 1003,0, etc. 2021-06-26 13:35:43 +02:00
Janez
1775b96450 Move emergency processing before NMT processing in CANopen.c
Hold emergency messages if not operational or pre-operational, don't
delete them.
There was a problem, if error condition was present after a
communication reset, device was in operational state for a short time.
2021-05-17 13:33:37 +02:00
Janez
e1b353f06c
Merge pull request #277 from JuPrgn/warning-fixes
Warning fixes
2021-03-22 21:52:42 +01:00
Janez
9824b740ca
Fixed invariant pointer in CO_Process #278 2021-03-22 21:13:11 +01:00
Julien PEYREGNE
b6f04d65f8 Fix null pointer dereference warnings 2021-03-19 09:54:17 +01:00
Janez
66d0e14ef4 301/CO_PDO.h/c updated to newOD. 2021-03-18 15:13:06 +01:00