Skip to content

NXP S32 introduce support PSI5 #79824

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

congnguyenhuu
Copy link
Collaborator

@congnguyenhuu congnguyenhuu commented Oct 15, 2024

Introduce support Peripheral Sensor Interface (PSI5) driver on S32Z. This driver allows to communication (send, receive) with PSI5 device.
The test result: PSI5-TESTING-RESULT.pptx

RFC: #83982

@congnguyenhuu congnguyenhuu changed the title Nxp S32 introduce support psi5 NXP S32 introduce support PSI5 Oct 15, 2024
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch from 0ee0652 to b50ef76 Compare October 15, 2024 06:00
@zephyrbot
Copy link
Collaborator

zephyrbot commented Oct 15, 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@d0e49d6 zephyrproject-rtos/hal_nxp#451 zephyrproject-rtos/hal_nxp#451/files

DNM label due to: 1 project with PR revision

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 15, 2024
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch 2 times, most recently from acc9b3e to 5a072e9 Compare October 24, 2024 07:20
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch 3 times, most recently from 101fad8 to dfebc33 Compare November 1, 2024 02:41
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch from dfebc33 to 69e051a Compare November 22, 2024 10:27
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch 3 times, most recently from 402551c to 9a0367b Compare December 5, 2024 07:52
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch 3 times, most recently from 4ce3d57 to eca2db8 Compare December 12, 2024 07:58
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch 4 times, most recently from 147bb43 to 05f2644 Compare January 10, 2025 09:43
@congnguyenhuu congnguyenhuu marked this pull request as ready for review January 15, 2025 03:15
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch 2 times, most recently from ce89bc9 to 5f95551 Compare February 27, 2025 08:11
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch 2 times, most recently from d263e57 to b7feffc Compare March 10, 2025 09:28
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch from b7feffc to ac6a683 Compare April 23, 2025 09:56
@congnguyenhuu
Copy link
Collaborator Author

congnguyenhuu commented Apr 23, 2025

Based on the suggestions from the Architecture WG meeting on March 4th, I have updated to the v1 changes. These updates include:

  1. Changed add_rx_callback(dev, channel, serial_cb, data_cb, user_data) to
    register_callback(dev, channel, struct psi5_rx_callback_configs callback_configs)

With the newly defined structure for RX callback configurations in psi5.h

struct psi5_rx_callback_config {
	psi5_rx_frame_callback_t callback;
	struct psi5_frame *frame;
	uint32_t max_num_frame;
	void *user_data;
};
 
struct psi5_rx_callback_configs {
	struct psi5_rx_callback_config *serial_frame;
	struct psi5_rx_callback_config *data_frame;
};
  1. RX buffers are allocated by the user to improve throughput:
  • Use the API register_callback to register the RX callback and allocate a user-defined RX buffer for each callback.
  • Count the number of RX buffer frames and trigger the RX callback when the count reaches the maximum buffer frame limit.
  • Reset the count when a RX error occurs or when the count reaches the maximum buffer frame limit.
  1. Tests and samples have been updated to demonstrate usage with the new changes

@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch from ac6a683 to c1a25f4 Compare April 25, 2025 02:59
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch from c1a25f4 to a13c0f6 Compare May 5, 2025 06:55
@congnguyenhuu
Copy link
Collaborator Author

New update as Dat's suggestion for PR

New updated PSI5 frame type, separate 2 type serial format 4 bit ID and 8 bit ID

enum psi5_frame_type {
	PSI5_SERIAL_FRAME_4_BIT_ID,
	PSI5_SERIAL_FRAME_8_BIT_ID,
	PSI5_DATA_FRAME
};

New updated PSI5 status, uses the common status RX frame and RX error all type frames

enum psi5_status {
	PSI5_TX_DONE,
	PSI5_TX_ERR,
	PSI5_RX_FRAME,
	PSI5_RX_ERR,
};

@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch from a13c0f6 to f33ecc0 Compare May 9, 2025 04:13
@congnguyenhuu
Copy link
Collaborator Author

I have updated to the v2 changes as the suggestion for SENT.
I removed the enum psi5_status.
Tx callback still report the status with changed type to int, status = 0 means tx done else tx error.
Rx callback just report the num_frame, An error frame is received (number received frames != expected amount), only report non-error frame.

@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch 2 times, most recently from 35290bb to 55a58a6 Compare May 13, 2025 02:46
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch from 55a58a6 to 1b6e29b Compare May 22, 2025 02:08
Dat-NguyenDuy
Dat-NguyenDuy previously approved these changes May 23, 2025
manuargue
manuargue previously approved these changes May 23, 2025
@manuargue
Copy link
Member

hi @carlescufi , @henrikbrixandersen . Can we remove the arch review label or is there anything else to discuss? Thanks

This driver allows to communication (send, receive) with PSI5 device

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
enable support psi5

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
Create test, sample for psi5 driver

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
@congnguyenhuu congnguyenhuu dismissed stale reviews from manuargue and Dat-NguyenDuy via dd659ec May 28, 2025 04:17
@congnguyenhuu congnguyenhuu force-pushed the nxp-s32-introduce-support-psi5 branch from 1b6e29b to dd659ec Compare May 28, 2025 04:17
Copy link

@carlescufi carlescufi removed the Architecture Review Discussion in the Architecture WG required label Jun 2, 2025
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 DNM (manifest) This PR should not be merged (controlled by action-manifest) 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.

10 participants