Commit Graph

234 Commits (master)

Author SHA1 Message Date
nakarlsson 66111d50fa
Merge pull request #176 from OpenEtherCATsociety/feature/add_sm_disabled_enabled_readback
Add readback that SM bit is set enabled/disabled
2024-03-27 11:09:03 +01:00
Andreas Karlsson 41438c4a33 Add readback that SM bit is set enabled/disabled
On PDI disable/enable, add polling readback that
it is set/cleared. Set 1 is delayed
until the end of a frame which is currently
processed, ET1100 datasheet.

This aligns the code base with SCC behavior.
2024-03-27 09:07:13 +01:00
nakarlsson 56124c2348
Merge pull request #170 from OpenEtherCATsociety/fix/reset_esc_repeat_ack
Sync local SM PDIreg with ESC PDIreg at Mbx start
2024-03-20 10:04:54 +01:00
Andreas Karlsson d04bed4666 Sync local SM PDIreg with ESC PDIreg at Mbx start
When starting mailbox service, write the value of
ECAT RepeatRequest to PDI RepeatAck. Otherwise
it is risk of a race condition when running
CTT and the repeat ack would hold the value
of previous repeat ack test.

The race condition occurs on slow targets
that doesn't handle the repeat request
fast enough. The resulting mailbox read
will come before the mailbox is emptied
on the SM changed event.

fixes
2024-03-20 08:26:25 +01:00
nakarlsson 05bf6c6726
Merge pull request #167 from OpenEtherCATsociety/fix/download_variable_using_CA
Fix padding of index 0 for object type variable
2024-02-05 16:38:10 +01:00
Andreas Karlsson 9525469a68 Fix padding of index 0 for object type variable
If object of type Variable return true bitsize
of subindex 0.

fixes #166
2024-02-05 09:36:04 +01:00
nakarlsson 3fe4511230
Merge pull request #152 from nakarlsson/fix/don_t_enable_debug_prints_by_default
Fix disable esc debug
2023-04-24 13:42:30 +02:00
Vijay Katoch e2f3fb7fd2 Fix disable esc debug 2023-04-24 13:39:34 +02:00
nakarlsson 6e70471e1b
Merge pull request #150 from nakarlsson/fix/Wconversion_generated_by_clang
Fix Wconversion issues for clang
2023-04-24 07:53:34 +02:00
Andreas Karlsson 70a1042188 Use inttypes print formatting macros
Use inttypes print formatting macros

Update DPRINT support for rt-kernel
2023-04-14 12:12:51 +02:00
Andreas Karlsson 2f4afb3230 Fix Wconversion issues for clang
Add explicit uint16_t cast for EoE header SET macros.
Used for SET of FrameInfo 1 and FrameInfo 2.

Increase datatype for offset used by EOE_HDR_FRAME_OFFSET_GET.

Change debug print formatting to %u for unsigned datatypes.
2023-04-14 12:12:22 +02:00
nakarlsson 5221cfbe76
Merge pull request #149 from nakarlsson/fix/warnings_generated_by_flag_Wconversion
Fix/warnings generated by flag wconversion
2023-03-29 12:13:27 +02:00
Andreas Karlsson 0d232899bb Enable Wconversion for Linux
Enable Wconversion for Linux for CI
to be used as regression.

Fix esc_hw.c warnings by adding explicit
typecasts. The code is based on Microchip
reference code so keep changes to a minimal.
2023-03-28 22:43:57 +02:00
Andreas Karlsson 3896a981ce Fix esc_foe Wconversion warnings
- make "size" variables not reflecting hardware or protocol
  uint32_t or size_t.

- add excplcit typecaste for uint8_t and uint16_t that need it
  due to integer promotion
2023-03-28 21:18:19 +02:00
Andreas Karlsson 45d390a014 Fix esc_eoe Wconversion warnings
- make "size" variables not reflecting hardware or protocol
  uint32_t.

- add excplcit typecaste for uint8_t and uint16_t that need it
  due to integer promotion

- split assignment using macros and bitwise operations to avoid
  implicit conversion and need of explicit conversion.
2023-03-28 21:18:14 +02:00
Andreas Karlsson f63bca476d Fix esc_coe Wconversion warnings
- make "size" variables not reflecting hardware or protocol
  uint32_t.

- change size_t to uint32_t to avoid conversion when compiling
  on x64

- add excplcit typecaste for uint8_t and uint16_t that need it
  due to integer promotion

- split assignment using macros and bitwise operations to avoid
  imlicit conversion and need of explicit conversion.

- add excplicit typecast to htoe MACROs
2023-03-28 21:17:59 +02:00
Andreas Karlsson d22277f4a5 Add typecast for bitwise operations of ESC
Add explicit typecasts for bitwise operations and
bitfields opeations of ESC.
2023-03-27 20:48:59 +02:00
Andreas Karlsson ac198e05b1 Add explicit typecast for ESC SM addressing
Add explicit typecast for uint16_t address
for ESC_read/WAC_write. The ESC RAM address
space is limited to 16Bit.
2023-03-27 20:48:59 +02:00
Andreas Karlsson 60e397aebc Change ESCvar member datatypes
* Align ESCvar.Alevent with ESC HW. Legacy it was 16-bit
      to be used with 2-byte mode SPI transfers that returned
      0x220-0x221.

* Increase size for fragments variables to avoid conversion
  warnings when counting mailbox data size. ESCvar.frags and
  ESCvar.fragsleft.
2023-03-27 20:48:59 +02:00
Andreas Karlsson 97472108e3 Add reference to objectlist in SM mappings
Rationale, users might need more info on what
object it is that is mapped. Having a reference to
objectlist enable the user to know what index it is
and got a reference to the entire object. The obj
only know what subindex it is.

fixes #137
2023-02-27 13:50:42 +01:00
Andreas Karlsson fd6dbdf188 Don't force packing of objd/objectlist stucts
objd/objectlist don't map to any EtheCAT protocol
headers, hence they don't need to be packed.

Pro and conns for packing or not.

Packed structs give optimized smaller size of ObjectDictionary.

Unpacked structs give optimized performance when iterating and
accessing processdata pointers.

Unpacked give more toolchain portable code.
2023-02-27 13:48:30 +01:00
Andreas Karlsson 3bb489469b Add support for CoE flags requried by MFC2020
Backup
Settings
RWop
RWpre_safe

(defined in ETG1000-6)

fixes #142
2023-02-27 13:48:30 +01:00
nakarlsson 8bb4350cd5
Merge pull request #140 from OpenEtherCATsociety/fix/bitpos_offset_in_mailbox_response
Add fix for bitpos2byteoffset
2022-11-28 16:49:51 +01:00
Andreas Karlsson fff8e22603 Add fix for bitpos2byteoffset
Can't use BITS2BYTE when calculating true bit offset
in a byte. Instead add a new macro that don't
round up to full byte size.

fixes #139
2022-11-26 13:11:34 +01:00
nakarlsson a7a017c26f
Merge pull request #120 from nakarlsson/master
Improve SM validation for input- ouput only slaves
2022-10-03 19:53:38 +02:00
nakarlsson ac0031aef5
Merge pull request #134 from m-dema/master
Exit eoe receive function if buffer is not valid
2022-09-27 18:23:37 +02:00
Andreas Karlsson 8ebb78ea10 Enable SM3 interrupt for input only slave
Enable SM3 interrupt if the slave only got
inputs.

On PREOP_TO_SAFEOP do an intial write to SM3,
otherwise the SM3 will never occur since there
is no data present to read.
2022-09-27 18:16:22 +02:00
m-dema 66b040a257
Exit eoe receive function if buffer is not valid
If buffer is invalid the call to the subsequent memcpy will corrupt memory
2022-09-23 17:04:42 +02:00
nakarlsson 8de160a851
Merge pull request #126 from fsugai/master
Fix: FOE_fwrite is unable to detect a failure if write_function fails to write on last data
2022-08-19 15:56:45 +02:00
Fumihito Sugai 35288ff3e7 Do not increment ncopied if failed writing 2022-08-19 22:47:45 +09:00
nakarlsson fc72fbeeec
Merge pull request #123 from konradhermsdorf/fix/rxpdo-handling-in-safeop
do not update output variables in SafeOp
2022-07-02 11:30:19 +02:00
Konrad Hermsdorf 254a6f807d do not update output variables in SafeOp
Just read SM data to reset SM Watchdog but do not update the output variables linked to the RxPDOs in SafeOp
2022-06-29 16:03:49 +02:00
andreas karlsson 48c80f5cae Impove SM validation for input- ouput only slaves
Re-add always verify SM length

Add validation of SM disabled, don't allow master
to activate or set a length if disabled.

Add validation of SM enabled, don't allow master
to set a length and de-activate.
2022-06-19 10:51:51 +02:00
nakarlsson acc59dd6b8
Merge pull request #119 from nakarlsson/master
Add support for input- or output only slaves
2022-06-15 20:58:33 +02:00
andreas karlsson 366c07f446 Add support for input- or output only slaves
Seperate validation of SM configuration that
depend on size of tx/rx pdo.

Add disable of SM3 when input only slave
reports error in OP.

Don't enable SM3 on start input if no inputs

Don't enable SM2 on start outputs if no
outputs

fix #112
fix #113
2022-06-15 20:50:31 +02:00
nakarlsson 6fc395e085
Merge pull request #117 from hefloryd/master
Declare rxpdo, txpdo as arrays
2022-06-02 14:16:26 +02:00
Hans-Erik Floryd d96f7cefef Declare rxpdo, txpdo as arrays
Rxpdo/txpdo were declared as external pointers if MAX_MAPPINGS2/3 were
0. However they must be declared as arrays for an external unit to be
able to use them as such.

Change-Id: I4bd547ae809ccfcb2dc1761f0f511f7e6088b712
2022-06-02 13:59:43 +02:00
nakarlsson fa0d6bf4d6
Merge pull request #116 from lrsdnlssn/master
Add support for Explicit Device Identification
2022-05-31 06:48:38 +02:00
Lars Danielsson 69b1049970 Add support for Explicit Device Identification
Change-Id: Idbf636f37c02923d251742cc5f49ff1579eaebc6
2022-05-30 15:51:20 +02:00
Hans-Erik Floryd 3c5af65be6
Merge pull request #109 from OpenEtherCATsociety/fix/download_segmented_completeaccess
Fix errornous segmented download CompleteAccess
2021-12-16 14:06:50 +01:00
andreas karlsson df0d169eef Fix errornous segmented download CompleteAccess
On the final segment the SDO shoud be written using the
pre-allocated buffer used to store segments during transfer.
When completed the pre-allocated buffer is written to the SDO.
This fix change to correct complete_access_subindex_loop
 - buffer, ESCvar.mbxdata
 - to use the lookup indexes for ESCVar.index -> nidx and
   ESCvar.subindex -> nsub.
2021-12-16 10:36:54 +01:00
nakarlsson 311977e47a
Merge pull request #105 from Joanle/fix-eeprom-command-def
correct eeprom command
2021-10-26 16:02:15 +02:00
Juan Leyva da33a714a1 Merge branch 'fix-eeprom-command-def' of https://github.com/Joanle/SOES into fix-eeprom-command-def 2021-10-26 08:50:04 -05:00
Juan Leyva cd12c0d156 correct eeprom command
change reload command to the correct value
2021-10-26 08:49:41 -05:00
nakarlsson ff6be22c80
Merge pull request #106 from hefloryd/master
Bump build platform and fix GCC9 warnings
2021-10-26 15:35:44 +02:00
Hans-Erik Floryd 2808e95668 Bump cmake version
Specifying a minimum cmake version 0f 2.8.4 triggers a warning with
never cmake, due to backwards compatibility issue. Bump to 2.8.12
which is the oldest version without the warning.
2021-10-26 09:36:04 +02:00
Hans-Erik Floryd 097477035d Fix address-of-packed-member warnings
GCC9 introduced an address-of-packed-member warning that triggers in
esc_coe.c. The issue is that a packed struct has an overall alignment
of 1, and taking the address of a member in a packed struct is not
guaranteed to have any particular alignment. However, in esc_coe these
structs are always overlayed on aligned memory so in practice there is
no problem.

Fix the problem by explicitly setting the minimum alignment for the
structs used in this manner. Also fix an instance where an unaligned
pointer was used but never dereferenced (by changing the type of the
pointer from uint32_t* to void*).
2021-10-26 09:36:04 +02:00
Hans-Erik Floryd 4d9da268be Bump build platform
Ubuntu 16.04 is now deprecated. Build using latest LTS.
2021-10-25 09:57:18 +02:00
Juan Leyva 5e94f0bb81 correct eeprom command
change reload command to the correct value
2021-10-15 23:32:20 -05:00
Hans-Erik Floryd 4549d0af9a
Merge pull request #103 from MechaMagpie/etherberry
Etherberry support
2021-09-06 16:44:29 +02:00