1
0
Fork 0
Commit graph

313 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
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
CISSOIDjmr
44183ee4b8 Add ability to override OD_readOriginal and OD_writeOriginal #634
With `CO_OVERRIDE_OD_READ_ORIGINAL` and `CO_OVERRIDE_OD_WRITE_ORIGINAL`
2026-07-03 14:22:33 +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
ac2140717c Mention bitwise PDO mapping in readme. 2025-11-22 12:40:47 +01:00
Janez
eba31e3a71
Merge pull request #572 from Sl-Alex/feature/pdo_bitwise_mapping
Implement PDO bitwise mapping

Disabled by default. Enable with CO_CONFIG_PDO_BITWISE_MAPPING configuration macro.
2025-11-22 12:34:46 +01:00
Stefan Tauner
b6e9107a9a
Refine #585 (#593)
In MR #585 the initialization of HBcons has been protected from dereferencing stream if it's NULL.
However, the logic is now twisted enough to provoke a maybe-uninitialized warning in GCC 13.
While this is strictly a false positive since the generated code would never dereference HBcons if stream == NULL
this patch refines the code to be easier to read for compilers and humans alike by returning early if stream == NULL.
2025-07-29 15:12:44 +02:00
Cory Van Beek
c7a4d26b38
Fix dereference before NULL check (#585)
You are right, thank you.
2025-07-15 15:00:55 +02:00
Tilen Majerle
6dfd4ed7f2
define variable before it is being assigned (#582) 2025-06-08 17:43:26 +02:00
Sl-Alex
ed36e44f28 Bitwise PDO implementation 2025-04-05 23:53:45 +02:00
Sl-Alex
039827c7a2 Mention that *_OD_IO_ACCESS is mandatory for bitwise PDO mapping 2025-04-04 15:13:21 +02:00
Sl-Alex
38c329e87d Check the maximum mapped objects for the PDO 2025-04-04 15:13:21 +02:00
Sl-Alex
006e3e3503 Use PDO bitwise mapping with *_OD_IO_ACCESS 2025-04-04 15:13:21 +02:00
Sl-Alex
cdc8cb872a Add a config option for PDO bitwise mapping 2025-04-04 15:13:21 +02:00
temi54c1l8
f454a3d82d
change for static analysis for CO_RPDO_process function (#564) 2025-03-01 16:54:38 +01:00
Janez
fbd42d46a2 Make OD_requestTPDO() more clear, remove OD_getFlagsPDO(). 2024-10-19 12:42:36 +02:00
Vincent Chatelain
9e9aaf5f8d
CO_ODinterface: fix unreachable statement (#548)
Using a `break` after a `return` triggers warning 111 of Arm Compiler 5. To fix this warning while respecting MISRA rules, the return mechanism of OD_getSub() function was changed to only exit at the end.
2024-10-19 00:51:48 +02:00
Janez
58012aae34 Fix links 2024-08-14 16:49:01 +02:00
Janez
05931a6b76 Fix and update doxygen documentation. 2024-08-07 00:17:39 +02:00
Janez
835bae5664 CO_SYNC: bugfix, if CO_CONFIG_FLAG_OD_DYNAMIC is disabled. 2024-07-13 15:29:58 +02:00
Janez
e85410e923 CO_PDO.c: additional safety check. 2024-07-12 15:56:19 +02:00
Janez
f41bfdcb5d Format comments in the .h files. 2024-07-09 00:17:15 +02:00
Janez
f46f1e2733 clang-format: ReflowComments: true 2024-07-07 01:05:10 +02:00
Janez
b87fad2195 Format the .h files using clang-format v15. 2024-07-06 21:54:59 +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
0d016a0019 Remove /*********...*/ comment delimiters. 2024-07-06 18:53:40 +02:00
Janez
f064eeaa40 Format the license information in files. 2024-07-06 13:03:00 +02:00
Janez
fcd89f87de Remove comments from arguments in CO_CANrxBufferInit and CO_CANtxBufferInit 2024-07-05 18:38:01 +02:00
Janez
7db21c1f91 CO_SDO_server.c fix missing "bufShifted" 2024-07-05 11:14:37 +02:00
temi54c1l8
675d11a33d CO_fifo: static analysis: format '%02X' specifies type 'unsigned int' which is nominally inconsistent with argument no. 3 of promoted type 'int' 2024-06-27 16:54:42 +02:00
temi54c1l8
86a5064e2f CO_fifo: static analisys: use of modifier or type outside of a typedef [MISRA 2012 Directive 4.6, advisory] 2024-06-27 16:43:00 +02:00
temi54c1l8
5a2f24bc4b static analysis: ANSI/ISO minimum translation limit of 31 'significant characters in an external identifier' exceeded, processing is unaffected 2024-06-27 14:49:37 +02:00
temi54c1l8
1c4a5f6877 CO_fifo: static analysis: multiple loop exits [MISRA 2012 Rule 15.4, advisory] 2024-06-27 13:31:08 +02:00
temi54c1l8
6fef978b69 CO_PDO: static analysis: dependence placed on operator precedence [MISRA 2012 Rule 12.1, advisory] 2024-06-27 13:21:43 +02:00
temi54c1l8
4ae66f9839 CO_SYNC: static analysis: ignoring return value of function 'CO_SYNCsend' [MISRA 2012 Directive 4.7, required], [MISRA 2012 Rule 17.7, required] 2024-06-27 12:58:54 +02:00
temi54c1l8
995fed609d CO_SYNC: static analysis: an unsigned value and a signed value cannot be used together [MISRA 2012 Rule 10.4, required] 2024-06-27 12:58:02 +02:00
temi54c1l8
d6b3163311 CO_SYNC: static analysis: dependence placed on operator precedence [MISRA 2012 Rule 12.1, advisory] 2024-06-27 12:53:30 +02:00
temi54c1l8
f684b34a03 CO_SYNC: static analysis: no 'else' at end of 'if ... else if' chain [MISRA 2012 Rule 15.7, required] 2024-06-27 12:51:06 +02:00
temi54c1l8
baa9e4e2b2 CO_Emergency: static analysis: argument 1 of type 'void *' is not compatible with argument 2 of type 'uint8_t *' (aka 'unsigned char *') in call to function 'memcpy' 2024-06-27 12:27:01 +02:00
temi54c1l8
a501f961d4 CO_Emergency: ignoring return value of functions [MISRA 2012 Directive 4.7, required], [MISRA 2012 Rule 17.7, required] 2024-06-27 12:24:20 +02:00
temi54c1l8
d9d9044221 CO_Emergency: 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-27 12:22:43 +02:00
temi54c1l8
58606174a2 CO_Emergency: static analysis: side effects on right hand of logical operator, '&&' [MISRA 2012 Rule 13.5, required] 2024-06-27 12:21:24 +02:00
temi54c1l8
42c39a2b51 CO_Emergency: static analysis: an unsigned value and a signed value cannot be used together as operands [MISRA 2012 Rule 10.4, required] 2024-06-27 12:19:07 +02:00
temi54c1l8
ce405b1e27 CO_Emergency: static analysis: body should be a compound statement [MISRA 2012 Rule 15.6, required] 2024-06-27 12:12:57 +02:00
temi54c1l8
7bf5065e41 CO_Emergency: static analysis: no 'else' at end of 'if ... else if' chain [MISRA 2012 Rule 15.7, required] 2024-06-27 12:11:19 +02:00
temi54c1l8
ca968aa160 CO_Emergency: static analysis: conditional of #if does not evaluate to 0 or 1 [MISRA 2012 Rule 20.8, required] 2024-06-27 12:08:42 +02:00
temi54c1l8
d76aeb178f CO_Emergency: static analysis: unsigned integer literal without a 'U' suffix [MISRA 2012 Rule 7.2, required] 2024-06-27 12:07:42 +02:00
temi54c1l8
071f6d7935 CO_Emergency: static analysis: dependence placed on operator precedence [MISRA 2012 Rule 12.1, advisory] 2024-06-27 12:06:07 +02:00
temi54c1l8
2e703328d8 CO_NMT_Heartbeat: static analysis: other minor change 2024-06-27 11:23:27 +02:00