1
0
Fork 0
Commit graph

59 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
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
Sl-Alex
ed36e44f28 Bitwise PDO implementation 2025-04-05 23:53:45 +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
temi54c1l8
f454a3d82d
change for static analysis for CO_RPDO_process function (#564) 2025-03-01 16:54:38 +01:00
Janez
e85410e923 CO_PDO.c: additional safety check. 2024-07-12 15:56:19 +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
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
Janez
7850623700
Update CO_PDO.c: make eventTime, inhibitTime and syncStartValue optional in object dictionary. 2024-06-26 12:40:17 +02:00
temi54c1l8
f7c7f9c104 Add more static analysis and MISRA.md
(cherry picked from commit ad337c3e9c4e879721ec432bc9a5d9a84a53c573)

# Conflicts:
#	CANopen.c
2024-06-24 17:46:34 +02:00
temi54c1l8
8cccf6f379 minor fix after static analysis 2024-06-14 13:46:21 +02:00
temi54c1l8
f9d8bdeff3 static analysys: local variable 'data' could be pointer to const [MISRA 2012 Rule 8.13, advisory]
refactory CO_CANrxMsg_readData return const
2024-06-14 11:27:22 +02:00
temi54c1l8
c41aa14680 CO_PDO: static analysis: named parameter 'timerNext_us' of 'non-virtual' function 'CO_RPDO_process' not subsequently referenced [MISRA 2012 Rule 2.7, advisory] 2024-06-14 11:09:31 +02:00
temi54c1l8
32c1086ac1 CO_PDO: static analysis: last value assigned to 'odRet' not used [MISRA 2012 Rule 2.2, required] 2024-06-13 12:23:38 +02:00
temi54c1l8
d9d24ffe82 CO_PDO: static analysis: unsigned integer literal without a 'U' suffix [MISRA 2012 Rule 7.2, required] 2024-06-13 12:17:28 +02:00
temi54c1l8
fe1709c42a CO_PDO: static analysis: argument 1 of type 'uint8_t [4]' is not compatible with argument 2 of type 'const void *' in call to function 'memcpy' 2024-06-13 12:05:39 +02:00
temi54c1l8
6f6936c9cc CO_PDO: static analysis: cannot assign 'enum' to different essential type 'unsigned8' [MISRA 2012 Rule 10.3, required] 2024-06-13 12:03:21 +02:00
temi54c1l8
fd8cf681a3 CO_PDO: static analisys: result of assignment operator used in right operand to '=' operator [MISRA 2012 Rule 13.4, advisory] 2024-06-13 11:58:04 +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
7399d31447 static analysis: ignoring return value of function 'OD_extension_init' [MISRA 2012 Directive 4.7, required], [MISRA 2012 Rule 17.7, required]
ignores the return because it was checked on the function argument
2024-06-11 15:09:49 +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
dc10900ad5 static analysis: Aggiunte parentesi per la dipendenza posta sulla precedenza dell'operatore [MISRA 2012 Rule 12.1, advisory] 2024-06-10 14:39:05 +02:00
temi54c1l8
a17b9fa209 static analysis: Ignoring return value of functions: CO_setUint8, CO_setUint16, CO_setUint32 [MISRA 2012 Directive 4.7, required] 2024-06-10 12:07:41 +02:00
temi54c1l8
e3206f2c7f static analysis: Ignoring return value of function 'memset' [MISRA 2012 Directive 4.7, required] 2024-06-10 11:56:47 +02:00
temi54c1l8
ddaa8974f1 static analysis: Ignoring return value of function 'memcpy' [MISRA 2012 Directive 4.7, required] 2024-06-10 10:30:59 +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
ZDH
361080da87 uint32_t fix for 16bit mcu's. 2023-03-28 19:38:03 +02:00
ankit.chudasama1
4c86a61342 Fix variable name and use of pointer for big endian system
1. Variable name update in CO_PDO.c file
2. Correct use of pointer in the CO_SDOserver.c file
2023-02-16 19:36:49 +05:30
Janez
1128bbbaf9
Wrong conditional compilation #420, fixed 2022-12-03 00:08:13 +01:00
Blazej1994
7249ea6acd
TPDO inhibitTime_us / evnetTime_us calculation fix
Added inhibiTime and eventTime casting to uint32_t
2022-07-14 11:48:08 +02:00
Janez
f1e39ccabb
Update CO_PDO.c 2021-08-24 08:20:37 +02:00
Tilen Majerle
88bc36da27
Add conditional compile statement for unused vars 2021-08-14 12:00:08 +02:00
Janez
fe3777b781 Verify for restricted CAN-IDs in SYNC, TIME, EMCY, PDO and SDO COB-ID configuration. 2021-08-09 14:12:19 +02:00
Janez
5338f110e1 Synchronous TPDO: send first in the middle between sync messages. 2021-08-09 14:08:31 +02:00
Janez
3ff84e21ff Fix some SDO abort messages. 2021-08-09 14:06:08 +02:00
Mattia Maldini
2e80d0304a Fixed bug with CANrxData buffer indexing 2021-07-14 19:19:28 +02:00
Freddie Chopin
e8d40fbfb7 Fix error in PDO_initMapping()
The loop should initialize only existing subindexes. Assuming that every
time there are CO_PDO_MAX_MAPPED_ENTRIES subindexes results in the
function returning CO_ERROR_OD_PARAMETERS because the call to
OD_get_u32() to read a non-existing subindex returns ODR_SUB_NOT_EXIST.
2021-07-05 12:33:58 +02:00
Janez
0d33cbb8bd Fix in CO_RPDO_process(), #283 2021-03-22 22:59:49 +01:00
Janez
66d0e14ef4 301/CO_PDO.h/c updated to newOD. 2021-03-18 15:13:06 +01:00
Janez
f73025ef65 CANopenNode V2.0 pre-release 2020-10-07 17:50:25 +02:00