Skip to content

NXP S32 introduce support SENT #80117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

congnguyenhuu
Copy link
Collaborator

@congnguyenhuu congnguyenhuu commented Oct 21, 2024

Introduce support Single Edge Nibble Transmission (SENT) driver using peripheral SENT receiver on S32Z. This driver allows to communication (read data) with SENT device.
The test result: SENT-RECEIVER-TESTING-RESULT.pptx

RFC: #83983

@zephyrbot
Copy link
Collaborator

zephyrbot commented Oct 21, 2024

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hal_nxp zephyrproject-rtos/hal_nxp@111f568 zephyrproject-rtos/hal_nxp@fc8aa27 (master) zephyrproject-rtos/[email protected]

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@zephyrbot zephyrbot added manifest manifest-hal_nxp DNM This PR should not be merged (Do Not Merge) labels Oct 21, 2024
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-sent branch 4 times, most recently from ec62630 to b483917 Compare October 28, 2024 03:29
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-sent branch 3 times, most recently from d00b883 to 23b01d3 Compare November 1, 2024 02:24
@congnguyenhuu congnguyenhuu marked this pull request as ready for review November 22, 2024 03:42
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-sent branch from 23b01d3 to 55d6a35 Compare November 22, 2024 03:42
@zephyrbot zephyrbot added platform: NXP S32 NXP Semiconductors, S32 area: Samples Samples labels Nov 22, 2024
@manuargue
Copy link
Member

@congnguyenhuu I'd suggest you to open an RFC (request for comments) and link it to this pr in order to involve community to review the proposal and reach consensus: https://docs.zephyrproject.org/latest/contribute/proposals_and_rfcs.html

@congnguyenhuu congnguyenhuu marked this pull request as draft November 22, 2024 04:32
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-sent branch from 55d6a35 to ec00dc8 Compare December 4, 2024 07:52
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-sent branch 5 times, most recently from c79ca4d to f2e3c0c Compare January 7, 2025 01:54
danieldegrasse
danieldegrasse previously approved these changes Jun 25, 2025
@dleach02 dleach02 closed this Jun 25, 2025
@dleach02
Copy link
Member

close/reopen to clear false bot block

@dleach02 dleach02 reopened this Jun 25, 2025
dleach02
dleach02 previously approved these changes Jun 25, 2025
Dat-NguyenDuy
Dat-NguyenDuy previously approved these changes Jun 26, 2025
@kartben kartben requested review from Copilot and removed request for KarstenBade June 26, 2025 02:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for the Single Edge Nibble Transmission (SENT) driver on NXP S32Z devices, including a new driver implementation, device tree bindings, test cases, samples, and documentation updates.

  • Added NXP S32 SENT receiver driver and API (drivers/sent/…)
  • Introduced DTS bindings and board overlays for SENT controllers and channels
  • Added tests (tests/drivers/sent/…), sample application (samples/drivers/sent/…), and documentation

Reviewed Changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 1 comment.

File Description
drivers/sent/sent_nxp_s32.c New NXP S32 SENT driver source implementation
include/zephyr/drivers/sent/sent.h SENT public API headers
dts/bindings/sent/sent-controller.yaml Device tree binding for SENT controller
tests/drivers/sent/sent_api/src/main.c API test cases for start/stop/register
Comments suppressed due to low confidence (3)

tests/drivers/sent/sent_api/src/main.c:105

  • The tests verify callback registration but do not exercise actual frame reception or callback invocation. Consider adding a mock or simulated SENT frame to validate the user callback path.
	err = sent_register_callback(sent_dev, SENT_CHANNEL, callback_configs);

drivers/sent/sent_nxp_s32.c:366

  • [nitpick] The term channel_map may be misleading since it holds hardware register addresses. Consider renaming to channel_hw_offsets or adding a clarifying comment.
		.channel_map = {DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP(n, DT_REG_ADDR, (,))},       \

doc/hardware/peripherals/sent.rst:17

  • [nitpick] The documentation lists only the generic CONFIG_SENT option. It could be helpful to reference the NXP S32-specific driver (e.g., CONFIG_SENT_NXP_S32) and point to the sample application.
* :kconfig:option:`CONFIG_SENT`

#
# SPDX-License-Identifier: Apache-2.0

description: Single Edge Nibble Transmission (SENT) Controller
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: Single Edge Nibble Transmission (SENT) Controller
description: SENT (Single Edge Nibble Transmission) Controller

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated

#
# SPDX-License-Identifier: Apache-2.0

description: NXP S32 Single Edge Nibble Transmission (SENT) Receiver Controller
Copy link
Collaborator

@kartben kartben Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: NXP S32 Single Edge Nibble Transmission (SENT) Receiver Controller
description: NXP S32 SENT (Single Edge Nibble Transmission) Receiver Controller

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated

Comment on lines 35 to 42
SENT_SHORT_SERIAL_FRAME,
SENT_ENHANCED_SERIAL_FRAME_4_BIT_ID,
SENT_ENHANCED_SERIAL_FRAME_8_BIT_ID,
SENT_FAST_FRAME
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum fields need Doxygen docs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated

Comment on lines 50 to 82
enum sent_frame_type type;

union {
struct {
uint8_t id;
uint16_t data;
} serial;

struct {
uint8_t data_nibbles[SENT_MAX_DATA_NIBBLES];
} fast;
};

uint32_t timestamp;
uint8_t crc;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Doxygen docs or mark as INTERNAL_HIDDEN if it's meant to be an opaque type from an API standpoint

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated to add doxygen

Comment on lines 96 to 121
sent_rx_frame_callback_t callback;
struct sent_frame *frame;
uint32_t max_num_frame;
void *user_data;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated

Comment on lines 174 to 175
* @retval 0 if successful.
* @retval -EINVAL if an invalid channel is given.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @retval 0 if successful.
* @retval -EINVAL if an invalid channel is given.
* @retval 0 success.
* @retval -EINVAL invalid channel.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated

Comment on lines 10 to 41
#define FAST_CRC_DISABLE 0
#define FAST_CRC_LEGACY_IMPLEMENTATION 1
#define FAST_CRC_RECOMMENDED_IMPLEMENTATION 2
#define FAST_CRC_STATUS_INCLUDE 4

#define SHORT_CRC_LEGACY_IMPLEMENTATION 0
#define SHORT_CRC_RECOMMENDED_IMPLEMENTATION 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Doxygen comments

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated

Overview
********

The sample application shows how to use the Single Edge Nibble Transmission (SENT) driver:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make "SENT (...)" a link to the SENT doc page

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated

Requirements
************

This sample requires a SENT sensor to be connected.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This sample requires a SENT sensor to be connected.
This sample requires a SENT sensor to be connected and exposed as ``sent-node`` Devicetree alias.

Copy link
Collaborator Author

@congnguyenhuu congnguyenhuu Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated to This sample requires a SENT sensor to be connected and exposed as ``sent0`` Devicetree alias.


/ {
aliases {
sent-node = &sent1;
Copy link
Collaborator

@kartben kartben Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit unconventional to use the -node suffix here IMO. Convention would be to call this sent0, I think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated to call sent0

Comment on lines 54 to 57
zassert_equal(err, 0, "Failed to start rx (err %d)", err);

err = sent_start_listening(sent_dev, SENT_CHANNEL);
zassert_not_equal(err, 0, "Started rx while started");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest using z_assert_ok() / z_assert_not_ok() instead for all these kinds of asserts

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated

@congnguyenhuu
Copy link
Collaborator Author

congnguyenhuu commented Jun 26, 2025

twister-build is failing, it fixes by PR #92238

This driver allows to communication (receive data) with SENT device

Signed-off-by: Cong Nguyen Huu <[email protected]>
enable support SENT

Signed-off-by: Cong Nguyen Huu <[email protected]>
Create test, sample for SENT driver

Signed-off-by: Cong Nguyen Huu <[email protected]>
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-sent branch from b49122f to d1d740a Compare June 26, 2025 16:14
Copy link

Copy link
Collaborator

@kartben kartben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work with the docs, much appreciated!

Copy link
Collaborator

@kartben kartben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work with the docs, much appreciated!

@dkalowsk dkalowsk merged commit 1a3f46c into zephyrproject-rtos:main Jun 27, 2025
34 checks passed
@manuargue manuargue deleted the nxp-s32-introduce-support-sent branch June 27, 2025 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree area: Process area: Samples Samples manifest manifest-hal_nxp platform: NXP S32 NXP Semiconductors, S32 RFC Request For Comments: want input from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.