1
0
Fork 0
Commit graph

147 commits

Author SHA1 Message Date
Janez
fc81777097 Pass CO_CANmodule_t argument to all the CO_LOCK_...() and CO_UNLOCK_...() macros.
https://github.com/CANopenNode/CANopenNode/issues/162#issuecomment-777438875
2021-03-02 21:28:22 +01:00
Janez
9b3f329d52 301/CO_SYNC.h/c updated to newOD. 2021-03-01 17:16:04 +01:00
Janez
bc54b697f4 CO_Emergency fix: CANdevTx is not optional field. CO_EM_init() arguments changed. 2021-02-25 08:35:55 +01:00
Janez
88558203a0 Linux socketCAN driver, fix CANsend().
There was a problem with block transfer, when transmitting sequence of
data. If CANsend() failed (socket buffer full), message was dropped.
Now dropped message is marked with bufferFull flag and then it is
re-transmitted later by the driver, as is in the original behaviour of
CANopenNode. Same as commit acd719e27 in v2.0.
2021-02-08 17:01:55 +01:00
Janez
3ee8725036 Simplify Data Storage
- remove CO_storage from CANopen.h/c (revert)
- add target specific CO_storage_entry_t into CO_driver(_target).h
2021-02-01 15:24:37 +01:00
Janez
49f7c80114 Heartbeat consumer updated to newOD 2021-01-30 14:40:27 +01:00
Janez
464a856a3f 301/CO_time.c updated to newOD. Some principles changed. 2021-01-25 12:52:52 +01:00
Janez
9dce037ecb Add data storage, common and Linux specific functions, tested in Linux. 2021-01-25 12:42:10 +01:00
Janez
5538b5e1f8 Remove CO_errinfo() from driver and put errInfo into CO_CANopenInit() as arg 2021-01-20 12:49:20 +01:00
Janez
51d64df860 OD interface simplified #162
OD_extension is now configurable by application only.
2021-01-07 08:34:53 +01:00
Janez
9e9fce74a9 Updates and testing of OD interface, SDO server, SDO client, gateway, etc.
- SDO server: Change behavior for string data type + fixes + test all
- SDO client: fixes + test all
- OD interface: Special behavior for string data type
- CO_driver.h: added default debug configuration macros + fix spelling
- Gateway + fifo: added base64 support + updates
- CO_CANopenInit() - added arguments.
- update some documentation
- CO_epoll_interface fixes.
- CO_main_basic.c updates
2020-12-24 14:15:10 +01:00
Janez
8e2de726a5 works also with globals 2020-10-27 13:13:13 +01:00
Janez
ace840fa6c Fix ODinterface, basic tests passed. 2020-10-26 18:16:00 +01:00
Janez
cf9fb2a547 Some updates in OD interface.
It matches newly generated OD.h and OD.c files from libedssharp
2020-10-21 11:29:03 +02:00
Janez
f73025ef65 CANopenNode V2.0 pre-release 2020-10-07 17:50:25 +02:00
Janez
a528eb1669 Better organised configuration macros (CO_config.h):
- rearranged and better documented
 - default values moved from CO_driver.h into appropriate files
 - rearranged also in CO_driver_target.h files
 - parts of the stack or whole objects can be disabled.
 - configuration is verified for depencies

Additional:
 - renamed some members of CO_Default_CAN_ID_t
 - moved helpers CO_setUint32() etc from CO_SDOserver.h into CO_driver.h.
 - change wrong CO_ERROR_PARAMETERS to CO_ERROR_ILLEGAL_ARGUMENT.
 - renamed CO_ERROR_PARAMETERS to CO_ERROR_OD_PARAMETERS
2020-09-14 15:50:21 +02:00
Carsten Frank
7b66b10dff
Fix lssAddress copy (#221) 2020-08-13 23:57: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
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
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
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
ae220f9115 Configuration for LSS updated. 2020-05-29 09:56:05 +02:00
Janez
f41069561a Make SDO client and NMT master optional in gateway_ascii 2020-05-28 16:40:21 +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
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
6c24ecfcec Globals alternative to heap now possible from CANopen.c 2020-04-29 13:08:40 +02:00
Janez
ffd5027cb2 Make SYNC optional in TPDO and RPDO. 2020-03-20 18:47:16 +01:00
Janez
c88194e813 Add Stack configuration macros to most of CANopenNode objects.
Add CO_NMT_initCallbackPre()
2020-03-19 18:07:23 +01:00
Janez
a98492ecaf Add heapMemoryUsed info from CO_new() 2020-03-06 11:33:25 +01:00
Janez
3fc564b72f Remove CO_CANopenInitCallback() from CANopen.h/.c (revert) 2020-02-27 15:25:59 +01:00
Janez
8fb48173c6 Add CO_CANopenInitCallback() into CANopen.h/.c.
Change CO_*_initCallback() functions - add 'void *object' argument.
2020-02-27 13:09:48 +01:00
Janez
9c0b16f981 minor corrections 2020-02-06 07:52:41 +01:00
Janez
ae48e57c33 CANopen.h/.c revision.
- example/main.c updated to microsecond time base.
- NMT master moved from CANopen.h/.c into 301/CO_NMT_Heartbeat.h/.c.
- CANopen.h/.c files revised, changes in interface, compare example/main.c.
- Removed CO_init() from CANopen.h/.c. Use separate functions instead.
- CO_USE_GLOBALS and global definitions removed from CANopen.c.
- CO_USE_OWN_CRC16 removed from CANopen.c. Use CO_driver_target.h.
2020-02-06 00:15:54 +01:00
Janez
c19879b659 Time base CHANGED TO MICROSECONDS in all objects. FIX OS!
- Necessary to update Time base in OS too - call to CO_process() function.
- timerNext_us info to OS implemented in in all objects.
- CO_NMT_blinkingProcess50ms() moved inside CO_NMT_process().
- CO_HBconsumer_process() function optimized and revised.
- Bugfix "timeDifference_us = 0;" inside the for loop.
2020-02-04 20:28:33 +01:00
Janez
a2531b0373 Merge branch 'master' into split-driver 2020-01-31 17:41:54 +01:00
Miles Simpson
a1f36cbe15 Removed maximum time restriction on timerNext_ms 2020-01-31 17:23:31 +01:00
Miles Simpson
38d5181807 Implemented changes based on PR feedback 2020-01-31 17:13:04 +01:00
Miles Simpson
729a139c12 Implementing PDO and SYNC timerNext_us return value 2020-01-31 17:13:04 +01:00
Janez
63df34d194 Rename CANdriverState to CANptr 2020-01-21 00:16:51 +01:00
Janez
06a0493c78 fix NMTstartup handling - update README and default values 2020-01-16 08:06:16 +01:00
Oleg
2fb8dfd223 fix NMTstartup handling if device is NOT the NMT Master (#150)
* fix NMTstartup handling if device is NOT the NMT Master and now OD_NMTStartup (0x1F80 OD) can be optional

issue #149

* Correctly use of NMTstartup to self start slave

According to DSP302, part2, V4.1.0, 2009 for object 1F80h (NMT startup):
bit0=0 - "CANopen device is not NMT master. The entries of the object 1F81h shall be ignored. All other bits of object 1F80h shall be ignored with the exception: value = 00000000 00000000 00000000 00001000b - "NMT slave that shall enter the NMT state Operational after the NMT state Initialisation autonomously (self starting)"
2020-01-16 07:58:01 +01:00
gotocoffee
cf015f2259
Update CANopen.c
#151
2020-01-15 15:48:24 +01:00
Oleg
f2283e3ca9 Warnings omitted (#144)
* All Warnings omitted
Now all warnings that came up in previous versions are fixed in a clean way directly in the code.
Inlcudes:
Shadowing
Missing default cases
Missing cases in switch statements
unused variables
Pointer problems
Function declarations' visibility

* Default case for NMTsendCommand
Default case was not catched before and could led to errors.

* fix typo when omitting warnings

* Omitting more warnings, and fix TIME->CANrxNew nulling

Inlcudes:
large integer implicitly truncated to unsigned type
this statement may fall through

* rename CO_this to co

* fix CO_process_SYNC name (CANopenNode master merging issue)

Co-authored-by: Michele B. <MicheleBlank@gmx-topmail.de>

----
Verified before merge. It is cleanup, no deep changes.
2020-01-15 13:40:30 +01:00
Martin Wagner
d7f28f8743
Merge branch 'master' into time-optional 2020-01-13 09:15:08 +01:00
Martin Wagner
aa08ebf51d
Merge pull request #142 from wilkinsw/add-missing-sync-guards
fix missing SYNC guards
2020-01-13 09:13:19 +01:00
Wilkins White
511a773151
Merge branch 'master' into time-optional 2020-01-08 08:46:54 -08:00
Janez
9c2f0a1c64 License changed to Apache 2.0 - main part 2020-01-08 14:52:56 +01:00
Wilkins White
36d49ee713
change TIME module to be optional 2019-12-20 10:21:58 -08:00
Wilkins White
8d6f25de40
fix missing SYNC guards 2019-12-20 10:14:49 -08:00
Wilkins White
0a4b2d3624
Merge branch 'master' into sync-optional 2019-12-16 13:59:34 -08:00
Martin Wagner
0069df9013
Merge pull request #135 from JuPrgn/FeatTimestamp
fix: CO_delete free TIME
2019-12-16 08:17:50 +01:00
Wilkins White
1c019bb48a add guard to deletion of CO->SYNC object 2019-12-10 16:33:21 -08:00
Wilkins White
f6d93fc300 change SYNC module to be optional
allows CO_NO_SYNC to be zero
2019-12-10 16:33:21 -08:00
Julien PEYREGNE
fef15a1ced fix: CO_delete free TIME 2019-12-09 11:43:36 +01:00
Martin Wagner
f9ea788caa
Merge pull request #124 from heliochronix/conditional_led
Conditionally compile LED state code
2019-12-09 08:36:12 +01:00
Martin Wagner
96fd0aa02b
Merge pull request #110 from JuPrgn/FeatTimestamp
feat: Add TimeStamp feature
2019-12-09 08:23:16 +01:00
Miles Simpson
79994e0ec9 Conditionally compile LED state code 2019-11-15 14:26:02 -08:00
Olivier Desenfans
02fd8ee9da Renaming CANdevicePtr to CANdriverState 2019-11-13 08:34:42 +01:00
Julien PEYREGNE
bba140f943 feat: Add TIME producer and refactor TIME consumer 2019-11-12 12:28:33 +01:00
Olivier Desenfans
e7d9652658 Use a void pointer for the CAN device address
Previously, the address of the CAN device (`CANbaseAddress`)
was specified as a signed or unsigned integer of variable size.
This made the ABI specific for each driver and is not generic
enough for some use cases.

Replaced all usages by using a void pointer instead.
Renamed `CANbaseAddress` to `CANdevicePtr`.
Refactored the code where it needed to be (some comparisons to -1).

Use a pointer to a user-defined variable/structure instead of
a 32-bit integer for CANbaseAddress. Renamed CANbaseAddress
to CANbaseStruct to reflect that change in behavior.

This is more modular and avoids casts.
2019-11-10 13:14:53 +01:00
trojanobelix
46a78ff308
Update CANopen.c
- correct handling if there is more than one SDO client configured.
2019-10-11 14:34:49 +02:00
JuPrgn
afa3a29f13
Fix mistake removed semicolon for dynamic aloc
Fix removed semicolon in CO_memoryUsed initialisation
2019-10-09 15:25:56 +02:00
JuPrgn
84577b72a4
Fix tabs and spaces 2019-10-09 14:56:14 +02:00
Julien PEYREGNE
e8262dc88f feat: Add TimeStamp feature 2019-10-09 14:31:26 +02:00
Martin Wagner
fa5f81e0a9 Merge branch 'master' of https://github.com/wilkinsw/CANopenNode 2019-10-08 10:01:50 +02:00
Martin Wagner
5601770589 Changed sdo client to support multiple sdo servers.
for existing code, you need to add "[0]" to the sdo function parameter CO->SDOclient (so you get CO->SDOclient[0]).
2018-09-13 09:12:21 +02:00
Benoit Rapidel
c0ec1da5ef CO_sendNMTcommand must return a CO_ReturnError_t, not a uint16_t 2018-09-05 09:10:15 +02:00
Martin Wagner
8512fec801 Merge branch 'add-lss' into neuberger-master 2018-09-05 08:34:21 +02:00
Martin Wagner
d189532337 Merge branch 'fix-emcy-timing' into neuberger-master 2018-09-05 08:33:30 +02:00
Martin Wagner
d5e31d6e06 lss init return value was ignored 2018-09-05 08:23:03 +02:00
gotocoffee
99e7dcc488 - forgot to change CANopen.c 2018-05-02 16:21:58 +02:00
Martin Wagner
360170cb70 enhanced emergency processing...
- emergency processing now affects CO_process() timerNext_ms
- timerNext_ms is gets set when either a message is ready to send, but inhibit time is not elapsed or when a message was sent to re-check the queue
- be aware that timer resolution is 1ms, whereas emergency inhibit time resolution is 100us. We round this up to the next ms.
2018-03-26 11:16:53 +02:00
Wilkins White
ee9d809d0f Expanded Emergency callback to take action when an emergency message is received. 2017-11-29 09:30:51 -08:00
Martin Wagner
f025b07ecd fix building LSS master 2017-09-07 10:15:37 +02:00
Martin Wagner
006b71e19d Added LSS fastscan master/slave
- other limitations still apply
2017-07-13 09:34:10 +02:00
Martin Wagner
9dbd2fc966 First try on LSS master addon...
- needs #define CO_NO_LSS_CLIENT 1 in CO_OD.h. This will need a change in the OD editor.
- still no fastscan support
- bitrate settin API untested
- some changes on LSS slave where necessary
2017-07-03 11:14:07 +02:00
Martin Wagner
03982ad8e3 First try on LSS slave addon...
- needs #define CO_NO_LSS_SERVER 1 in CO_OD.h. This will need a change in the OD editor.
- no Fastscan support yet
- bitrate setting API untested
- https://github.com/CANopenNode/CANopenNode/issues/46 (driver stuff)
- changed some of the other stack files, tried my best to remain compatible with standard non LSS CANopenNode
2017-06-26 13:04:02 +02:00
CANopenNode
43a37e2a7f Merge pull request #34 from martinwag/add-custom-crc
Compiler switch enables providing own CRC16 implemetation.
2017-05-20 16:25:48 +02:00
Martin Wagner
ba09c22be8 Assuming valid address is not acceptable in professional environment 2017-05-10 15:29:54 +02:00
Martin Wagner
9e6b1c296c Compiler switch enables providing own CRC16 implemetation.
This enables the stack user to use a different calculation method. This
is needed to save space (no table) or to use hardware crc unit.
Implementation can be located in driver directory.
2017-05-10 15:29:08 +02:00
Janez
5df11b9d74 SYNC timeout bugfix; synchronous PDOs are now processed after next sync. 2016-09-07 16:08:07 +02:00
Janez
85fc85482e Added trace interface for monitoring variables. 2016-03-24 22:01:44 +01:00
Janez
e6db254c63 Added CO->CANmodule[x]->CANnormal to all drivers. example/main.c updated. 2016-01-12 13:48:16 +01:00
Janez
41b8d903b7 License changed to the GNU General Public License version 2 with the classpath exception. 2016-01-10 00:15:50 +01:00
Janez
8d0420b432 PIC24, dsPIC33 - EDS and DMA macros changed and moved from CANopen.c to CO_driver.c.
directory PIC24H_dsPIC33F renamed to PIC24_dsPIC33.
https://sourceforge.net/p/canopennode/discussion/387151/thread/281ffd7f
2016-01-07 15:28:49 +01:00
Janez
3bf4b812ed Merge branch 'master' of https://github.com/CANopenNode/CANopenNode 2015-12-13 22:50:57 +01:00
Janez
5924c3dc69 NMT master updated. 2015-12-12 17:52:29 +01:00
Jens Nielsen
13be332db3 Allow multiple SDO objects 2015-12-07 18:37:01 +01:00
JanezXD
b716643845 timerNext_ms returned from CO_process() and others. 2015-09-04 18:31:21 +02:00
JanezXD
bbc165c218 First run of socketCan. 2015-08-29 01:13:54 +02:00
Janez_dw
69293ab422 CANopen.c: Node ID and CAN bit rate added as argument to CO_init(). 2015-08-28 07:27:40 +02:00
Janez_dw
345b37b573 Some cleanup. 2015-08-27 18:57:34 +02:00
Janez_DW
8427cbcc90 Added testing against null pointers in _init functions.
Updated CO_process_SYNC_RPDO and CO_process_TPDO in CANopen.c.
2015-08-26 15:41:21 +02:00
Janez_DW
730bc57a42 Revision of the CANopen SYNC message. Received synchronous PDOs are now processed after the SYNC. 2015-08-25 19:17:18 +02:00
JanezXD
12f33a4a7b Example files moved to base directory. Added template for socketCAN drivers (based on BECK SC 243) 2015-07-30 19:58:06 +02:00
Renamed from example/CANopen.c (Browse further)