Skip to content

Flexio SPI loopback test failed on fast speed(16Mbps) #88877

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 2 commits into
base: main
Choose a base branch
from

Conversation

Raymond0225
Copy link
Collaborator

@Raymond0225 Raymond0225 commented Apr 21, 2025

drivers: spi: nxp: flexiospi spi_loopback test failed on flexio spi

Several reason cause loopback test failed:
a) FlexIO input frequency is not correct, on RT11xx, input freq is 24M,
while max bandrate can reach 1/4 of input freq, so it can only support
6Mbps.
b) Flexio shift register depend on correct timer output to triggger TX
and TX, if timer comparison value is not accurate, RX error happens on
high band rate. This is the reason why test fails on RT1060.

also fix a error on FlexIO clock ID calculation.

test: drivers: spi_loopback: Flexio spi support for RT1060 EVKC and RT1170 EVK

Add overlay file for RT1170 EVK and simply existing flexio spi overlay
file for RT1060 and RT1064 EVK. One flexio-spi interface for both slow
and fast tests. Fast bandrate set to 16Mbps now.

fix this issue: #77992

@@ -206,6 +206,24 @@ static void spi_flexio_master_init(FLEXIO_SPI_Type *base, flexio_spi_master_conf
timerConfig.timerStart = kFLEXIO_TimerStartBitEnabled;
/* Low 8-bits are used to configure baudrate. */
timerDiv = (uint16_t)(srcClock_Hz / masterConfig->baudRate_Bps);

/* Add protection if bandrate required is overflow.
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
/* Add protection if bandrate required is overflow.
/* Add protection if the required baud rate overflows.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks, done

@@ -206,6 +206,24 @@ static void spi_flexio_master_init(FLEXIO_SPI_Type *base, flexio_spi_master_conf
timerConfig.timerStart = kFLEXIO_TimerStartBitEnabled;
/* Low 8-bits are used to configure baudrate. */
timerDiv = (uint16_t)(srcClock_Hz / masterConfig->baudRate_Bps);

/* Add protection if bandrate required is overflow.
* FLEXIO input freq can not meet required bandrate. Max bandrate can
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
* FLEXIO input freq can not meet required bandrate. Max bandrate can
* FLEXIO input freq cannot meet required baud rate. Max baud rate can

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done, thanks

/* Add protection if bandrate required is overflow.
* FLEXIO input freq can not meet required bandrate. Max bandrate can
* not exceed 1/4 of input freq. You can raise input freq or lower
* bandrate required to remove this warning.
Copy link
Collaborator

@JarmouniA JarmouniA Apr 21, 2025

Choose a reason for hiding this comment

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

Suggested change
* bandrate required to remove this warning.
* baud rate required to remove this warning.

Apply everywhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

Choose a reason for hiding this comment

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

Still not addressed

@@ -215,6 +215,18 @@ __weak void clock_init(void)
CLOCK_SetDiv(kCLOCK_LpspiDiv, 0); /* Set SPI divider to 1 */
#endif

#ifdef CONFIG_MCUX_FLEXIO
/* Configure input clock to be able to reach the datasheet specified band rate.
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
/* Configure input clock to be able to reach the datasheet specified band rate.
/* Configure input clock to be able to reach the datasheet specified baud rate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done, thanks

Several reason cause loopback test failed:
a) FlexIO input frequency is not correct, on RT11xx, input freq is 24M,
while max bandrate can reach 1/4 of input freq, so it can only support
6Mbps.
b) Flexio shift register depend on correct timer output to triggger TX
and TX, if timer comparison value is not accurate, RX error happens on
high band rate. This is the reason why test fails on RT1060.

also fix a error on FlexIO clock ID calculation.

Signed-off-by: Raymond Lei <[email protected]>
@Raymond0225 Raymond0225 force-pushed the flexIO_spi_input_freq_fix branch from 17d6aa5 to 15439f7 Compare April 22, 2025 16:32
@Raymond0225 Raymond0225 requested a review from JarmouniA April 22, 2025 16:36
@Raymond0225 Raymond0225 force-pushed the flexIO_spi_input_freq_fix branch from 15439f7 to 79f39f0 Compare April 22, 2025 16:52
Add overlay file for RT1170 EVK and simply existing flexio spi overlay
file for RT1060 EVKC and RT1064 EVK. One flexio-spi interface for both slow
and fast tests. Fast bandrate set to 16Mbps now.

Signed-off-by: Raymond Lei <[email protected]>
@Raymond0225 Raymond0225 force-pushed the flexIO_spi_input_freq_fix branch from 79f39f0 to 457bbe3 Compare April 24, 2025 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants