1
0
Fork 0
Commit graph

351 commits

Author SHA1 Message Date
Janez
d98fb635f5 Added CO_ODinterface 2020-07-13 14:08:16 +02:00
Janez
e79ed1709e Update documentation 2020-07-13 14:07:26 +02:00
Janez
997a311a38 Fixed: delay between gateway commands #208 2020-07-08 13:48:49 +02:00
Janez
035da160b5 SDO: fix to always check if buffer is empty before freeing it #204
Before this patch SDO queue process pointer could overrun receive pointer on receiving NMT stop command during active SDO communication.
This fix is applied to 'master' and 'v1.3-master' branches.
2020-07-01 09:44:18 +02:00
Janez
9dd36aa649 Manual merge #202:
- fix conflicts in CO_SRDO.h and CO_SRDO.c
- Add configs for GFC & SRDO for CO_driver.h and not for socketCAN
- Fix doxygen for CO_gateway_ascii
2020-07-01 09:02:40 +02:00
gotocoffee
3a50bc88c7
SRDO tx & rx extension (#201)
* CANopen Safety (SRDO according to DIN EN 50325-5:2016)

* GFC code and docs

* clang-format on GFC

* SRDO tx and rx extension
added CANopen Safety to README.md
allow manual SRDO transmit
some minor bug fixes

Co-authored-by: rg1 <r.gruening@miunske.com>
2020-06-30 19:17:55 +02:00
Freddie Chopin
3cf4f62109 Completely disable CO_gateway_ascii module if not enabled by config
When CO_CONFIG_GTW_ASCII is not enabled in configuration, this module
produces multiple important warnings, like 2 warnings about implicit
function declaration. Instead of making the source more complex and
fixing each warning individually, in this case it is much easier to just
completely disable compilation of the whole thing.
2020-06-26 12:35:46 +02:00
Freddie Chopin
3fbaec1d5e Add configs for GFC & SRDO for socketCAN, otherwise the test build fails
Default "make" for CANopenNode would fail with an error, because for
socketCAN CO_CONFIG_SRDO_MINIMUM_DELAY was not defined.
2020-06-26 12:09:37 +02:00
Freddie Chopin
19bf4a7fd5 Fix warnings about unused arguments and variables in CO_GFC.c 2020-06-26 12:03:18 +02:00
Freddie Chopin
6da668fc7e Fix whitespace issues in CO_SRDO.c and CO_SRDO.h 2020-06-26 11:58:19 +02:00
Freddie Chopin
7c13199a1a Fix all possible warnings about unused timerNext_us argument 2020-06-26 11:56:46 +02:00
gotocoffee
0f7b3e2d17
CANopen Safety (SRDO according to DIN EN 50325-5:2016) (#196)
* CANopen Safety (SRDO according to DIN EN 50325-5:2016)

* GFC code and docs

* clang-format on GFC

Co-authored-by: rg1 <r.gruening@miunske.com>
2020-06-22 10:14:14 +02:00
Janez
aed6a472d4 LSS led flickering fix. 2020-06-14 12:35:42 +02:00
Janez
ca452c47cc CO_driver interface: remove Emergency object dependency for reporting CAN
errors, use CANerrorStatus own variable instead. Emergency object updated.
2020-06-13 14:06:35 +02:00
Janez
e1c7e2dbfa Add fifo queue for SDO received messages to fix possible drops
Same as pr #174 in v1.3-master
2020-06-11 10:33:03 +02:00
Janez
9ab7ce19ca Merge branch 'master' of https://github.com/CANopenNode/CANopenNode 2020-06-10 09:14:51 +02:00
Janez
35854fd6a0 CO_trace: fix warning "cast increases required alignment of target type"
Same as #193 in v1.3-master
2020-06-10 09:13:49 +02:00
Paolo Teti
6551233406
GCC 10: Fix dereference of NULL warning (#191)
GCC 10 static analyzer (-fanalyzer) warn about possible dereference
of NULL ‘ext’ on 'ext->pODFunc'.

This patch adds a guard on 'ext' to fix the issue.
2020-06-09 17:11:09 +02:00
Janez
dd1677b5bc Integrate LSS slave into CANopenNode more directly.
- CO_LSSslave: move expensive code from CAN receive (interrupt) to mainline
  CO_LSSslave_process() function.
- LSS slave now runs in parallel to other CANopen objects.
- LSS slave and master can run both on same device.
- LSS slave, LSS master and gateway-ascii(CiA309) LSS functions tested.
- LSSusage.md updated.
2020-06-09 14:55:07 +02:00
Janez
ae1b66e6ea Gateway - command interface: update help strings, add status LED indication 2020-06-06 08:07:26 +02:00
Janez
bd3326fed9 Make own file for CANopen status LED diodesLED indicator indication
(CiA303-3) moved from NMT into own files. Now fully comply to standard.
2020-06-05 18:02:26 +02:00
Janez
229b5c5fd3 Change optional arguments in CO_RPDO_init(), CO_TPDO_init(), CO_GTWA_init() 2020-05-31 22:08:36 +02:00
Janez
92a803f169 Add LSS master into gateway-ascii (CiA309).
- Rename local variable 'token' into 'tok' in CO_GTWA_process().
- CO_LSSmaster: replace CO_LSSmaster_InquireNodeId() with more generic
  CO_LSSmaster_Inquire(). CiA309-3 command 'lss_inquire_addr' now works
  also according to standard.
- CANopen.h: fix doxygen.
- gettingStarted.md: Change example "master" device from node-Id=3 to 1...
2020-05-31 14:31:30 +02:00
Janez
ae220f9115 Configuration for LSS updated. 2020-05-29 09:56:05 +02:00
Janez
cb9b2cce42 Add printout of message log from CANopen gateway-ascii (non-standard). 2020-05-29 07:36:23 +02:00
Janez
f41069561a Make SDO client and NMT master optional in gateway_ascii 2020-05-28 16:40:21 +02:00
Janez
ecce574965 fix according to standard:
- There is no white space between the “ERROR:” string and the <error-code> value.
- non-case-sensitive ASCII strings
2020-05-28 09:38:30 +02:00
Paolo Teti
6db813a998
TIME: fix round up conversion from usec to msec (#189)
Use standard idiom for integer rounding up.

Signed-off-by: Paolo Teti <paolo.teti@gmail.com>
2020-05-27 13:48:16 +02:00
Paolo Teti
6c16680d02
Use memcpy() and memset() where possible (#188)
* LLSMaster: replace explicit array element copy with memcpy()

Replace explicit array element copy with memcpy()

Signed-off-by: Paolo Teti <paolo.teti@gmail.com>

* SDO server: copy and zeroize arrays using memcpy() and memset()

* Replace array elements copy with memcpy().
* Clear response buffer using memset()

Signed-off-by: Paolo Teti <paolo.teti@gmail.com>
2020-05-27 13:42:50 +02:00
Janez
c1a30b8a03 Some style corrections
- add CO_fifo_st enumerator for use in CO_fifo_cpyTok2xx functions.
- 309/CO_gateway_ascii: add x8 to x64 nonstandard data types
- example compiles now
- Fix "unused argument" warnings in socketCAN
2020-05-15 15:52:22 +02:00
Freddie Chopin
288f8c603f
Fix fifo include (#184)
* Include CO_fifo.h in CO_SDOclient.h in all cases

Struct CO_SDOclient_t has CO_fifo_t member no matter what configuration
is set, so the header is always required. Without this change the build
fails when CO_CONFIG_SDO_CLI_SEGMENTED is not enabled.

* Fix minor copy-paste errors in CO_config.h comments
2020-05-14 16:24:04 +02:00
Freddie Chopin
d272934647
Fix new -Wextra warnings (#185)
* Fix new "unused argument" warnings

* Fix "variable may be used uninitialized" in CO_process_SYNC()

With enabled optimization compiler reports:

CANopen.c: In function ‘CO_process_SYNC’:
CANopen.c:890:12: warning: ‘syncWas’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
  890 |     return syncWas;
      |            ^~~~~~~
2020-05-14 16:23:02 +02:00
Janez
3c6a197650 Update readme 2020-05-12 18:35:23 +02:00
Janez
b5bfeec42a Added CANopen gateway-ascii command interface according to CiA309-3 as a
microcontroller independent module.
It includes NMT master, LSS master and SDO client interface.
Interface is non-blocking, it is added to mainline.
Example for Linux stdio and socket is included.

Added CO_fifo.h/c for fifo data buffer, used with rewritten SDO client, etc

SDO client is rewritten. Now includes r/w fifo interface to transfer data.

doc/gettingStarted.md is updated.
2020-05-12 18:11:43 +02:00
Paolo Teti
61fc785fab
CO_SYNC_process: use enums instead of uint8_t (#182)
Replace hard-coded values with enums and explicit manage all enumeration
values in CO_process_SYNC() to avoid warnings like this:

CANopen.c:837:5: warning: enumeration value ‘CO_SYNC_NONE’ not handled in switch [-Wswitch]
  837 |     switch (sync_process) {
      |     ^~~~~~
2020-05-12 17:35:16 +02:00
Janez
d9c16ae763
Merge pull request #183 from DISTORTEC/even-moar-callbacks
Add CO_TIME_initCallbackPre(), convert {T,R}PDO_CALLS_EXTENSION to config options
2020-05-12 17:30:59 +02:00
Freddie Chopin
0048cb52c7
Fix pointer bug in CO_OD_getFlagsPointer() (#181)
Function did not check whether the object had any flags assigned. It
makes no difference for objects with no subindexes, because then the
function will return NULL anyway. But is subIndex argument is not zero,
then the function calculates addresses of flags as offsets from NULL.
For example, for an object with no flags assigned, when subIndex == 5,
the function would return 5 as the address instead of the expected NULL.
2020-05-12 17:24:06 +02:00
Martin Wagner
a773713d91
Merge pull request #180 from DISTORTEC/wextra_warnings
Fix a couple of warnings which appear with -Wextra option for gcc
2020-05-07 07:13:55 +02:00
Freddie Chopin
b4b0fe069f Convert {T,R}PDO_CALLS_EXTENSION to CO_CONFIG_{T,R}PDO_CALLS_EXTENSION
User can now enable extension callbacks in RPDO/TPDO handling paths
simply by configuration flags instead of modifying sources or by passing
the defines directly to the compiler.
2020-05-06 18:22:50 +02:00
Freddie Chopin
9b8a296fb7 Add CO_TIME_initCallbackPre() for received TIME messages
This optional mechanism allows to immediatelly wake the thread that
processes TIME, without waiting for its next tick.
2020-05-06 18:08:45 +02:00
Freddie Chopin
495f827d37 Fix minor typo/edit mistakes in CHANGELOG.md and CO_config.h 2020-05-06 18:00:28 +02:00
Freddie Chopin
e88ecb894e Fix "unused parameter" warnings
Some functions have a signature required by API, thus they have
arguments which will be unused. Fix by casting to void.
2020-05-06 16:31:36 +02:00
Freddie Chopin
466bf0ffb7 Fix "comparison of integer expressions of different signedness" warning
With -Wextra GCC gives:

socketCAN/CO_driver.c: In function ‘setRxFilters’:
socketCAN/CO_driver.c:159:19: warning: comparison of integer expressions
of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’}
[-Wsign-compare]
  159 |     for (i = 0; i < CANmodule->CANinterfaceCount; i ++) {
      |                   ^
2020-05-06 16:31:36 +02:00
Freddie Chopin
aa6075b3c8
Add CO_..._initCallbackPre() for RPDO and SYNC (#178)
* Merge two parts of CO_PDO_receive() into single common code

* Add CO_RPDO_initCallbackPre() for received RPDO messages

This optional mechanism allows to immediatelly wake the thread that
processes RPDO, without waiting for its next tick.

* Add CO_SYNC_initCallbackPre() for received SYNC messages

This optional mechanism allows to immediatelly wake the thread that
processes SYNC, without waiting for its next tick.
2020-05-05 13:23:26 +02:00
Freddie Chopin
4c3011d34a
Replace all memcpy/memset-like functions with standard <string.h> functions (#175)
* Use standard memcpy() instead of CO_memcpy()

* Remove CO_memcpy()

* Use standard memset() instead of CO_memset()

* Remove CO_memset()

* Move helper functions from CO_SDOserver.c to header and make them inline

* Implement CO_getUint16() with memcpy()

* Implement CO_getUint32() with memcpy()

* Implement CO_setUint16() with memcpy()

* Implement CO_setUint32() with memcpy()

* Define memcpy() as CO_memcpySwapX() for little-endian systems

* Fix several writes past the buffer due to hardcoded sizes

Use more "generic" sizes (via sizeof()) instead of hardcoded number in
all calls to memset() to avoid 1-byte errors which result in writes past
the buffer, for example:

memset(&LSSslave->TXbuff->data[5], 0, 4);
in CO_LSSslave_serviceInquire()

memset(&LSSmaster->TXbuff->data[6], 0, 3);
in CO_LSSmaster_switchStateSelectInitiate()

* Use "generic" size in calls to memcpy() where possible

* Remove CO_bytes_t

This type was used only for CO_{get,set}Uint{16,32}().
2020-05-04 11:22:32 +02:00
Janez
5a2a1e85cf Update configuration macros. SDO state machine preview. 2020-04-29 13:12:07 +02:00
Janez
6c24ecfcec Globals alternative to heap now possible from CANopen.c 2020-04-29 13:08:40 +02:00
Janez
06e6f343c9 Update changelog 2020-04-27 12:18:47 +02:00
Janez
417fe97510 Merge branch 'master' into split-driver 2020-04-27 11:50:16 +02:00
Janez
5bb2d16323 fix SDO block download process continuity after sequence breaks
This is the same as pull request #171, but applied to split-driver branch.
Original author: Oleg <ev.mipt@gmail.com>

Now additional state CO_SDO_ST_DOWNLOAD_BL_SUB_RESP_2 is used to send response without resetting SDO sequence.
Refactoring timeout halding logic in sub-block transfer.
Also add missed unsigned indicators for several constants.

issue #170
2020-04-07 09:41:00 +02:00