LPSPI3 slave on GPIO_AD_B1 doesn't receive data

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPSPI3 slave on GPIO_AD_B1 doesn't receive data

Jump to solution
1,892 Views
jobst
Contributor II

Hello friends,

I'm trying to get the LPSPI3 peripheral working in slave mode connected to GPIO_AD_B1_XX. But at least I was not able to receive any data from an other master. I tried DMA, interrupt and polling :-(.

I'm using the RT 1051 on a custom board. The electrical connection between master and slave is working fine and I have verified the signals (level and frequency). I'm sure, this is not any kind of hardware bug.

I configured the MUX, clock and the LPSPI3 with the MCUXpresso Config Tools v5 and SDI/SDO is reversed for acting as slave.

When I check the LPSPI registers, the TXCNT of FSR register doesn't decrease and the RXCNT doesn't increase.

Also the RXEMPTY bit of RSR register is always set and the RDR register keeps empty.

Has anyone struggled with the same behavior?

Is there any possibility to get the state of the PCS signal by the LPSPI3?

I'm thankful for any ideas :-)

Greetings,

Julian

1 Solution
1,656 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Julian,

    Thank you very much for your updated information, it is really the valuable information.

   LPSPI3_SCK pin is really nee dto set the daisy chain, otherwise, it will be in GPIO_AD_B0_00_ALT7 after reset:

  pastedImage_1.png

It is really like what you have said, it should be:

#define IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK 0x401F8138U, 0x2U, 0x401F8510U, 0x1U, 0x401F8328U

It is the SDK driver bug, I will report this bug to our related department, and it will be fixed in the next version.

The according LPSPI3 other pin also need to checked, but it seems other pin configuration is correct with daisy.

I will report this problem to our related department, and check all the daisy pins.

Thanks a lot for your contribution.
Have a great day,
Kerry

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

6 Replies
1,656 Views
jobst
Contributor II

Hello Kerry,

I was able to get the LPSPI3 in slave mode working.

The problem was caused by a bug in the fsl_iomuxc.h file of the MCUXpresso SDK.

The following definition is wrong:

#define IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK 0x401F8138U, 0x2U, 0, 0, 0x401F8328U

because the Address and the value for the LPSPI3_SCK_SELECT_INPUT DAISY Register is missing.

it should be:

#define IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK 0x401F8138U, 0x2U, 0x401F8510U, 0x1U, 0x401F8328U

It seems that this issue concerns also other definitions in the fsl_iomuxc.h. Maybe a code generation problem?

Kerry, could you please verify this bug in the MCUXpresso SDK? I found this issue in V.2.5.0 and V.2.5.1. I didn't check older versions of the SDK

Greetings,
Julian

1,657 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Julian,

    Thank you very much for your updated information, it is really the valuable information.

   LPSPI3_SCK pin is really nee dto set the daisy chain, otherwise, it will be in GPIO_AD_B0_00_ALT7 after reset:

  pastedImage_1.png

It is really like what you have said, it should be:

#define IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK 0x401F8138U, 0x2U, 0x401F8510U, 0x1U, 0x401F8328U

It is the SDK driver bug, I will report this bug to our related department, and it will be fixed in the next version.

The according LPSPI3 other pin also need to checked, but it seems other pin configuration is correct with daisy.

I will report this problem to our related department, and check all the daisy pins.

Thanks a lot for your contribution.
Have a great day,
Kerry

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

912 Views
DaPa1
Contributor III

The issue seems to not be fixed yet in the SDK, as of latest version 2.12.1 [2022-09-26]

0 Kudos
1,656 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Julian,

    You said:"I'm using the RT 1051 on a custom board. The electrical connection between master and slave is working fine and I have verified the signals (level and frequency). I'm sure, this is not any kind of hardware bug."

   Do you send the SPI wave, it works OK both in master and slave mode?

   Your LPSPI3 can't work, do you check the SPI bus, whether the SPI bus wave is correct or not?

   If you don't use the DMA, just use the SPI slave, whether it can works or not?


Have a great day,
Kerry

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,656 Views
jobst
Contributor II

Hello Kerry,

when I configure the LPSPI3 as master (same pin muxing), I'm able to send SPI frames and measure them with the oscilloscope. All signals (SDO, SCK and PCS0) has the expected behavior, voltage level and frequency.

So, master mode is working correctly but slave not.

To minimize error sources, I'm currently polling the SPI but no frame is received.

For further investigations, I'm have used the IMXRT1050-EVKB:

I started with the evkbimxrt1050_cmsis_lpspi_int_b2b_transfer_slave example and changed the pin_mux to

- IOMUXC_GPIO_AD_B0_00_LPSPI3_SCK to IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK

- IOMUXC_GPIO_AD_B0_01_LPSPI3_SDO to IOMUXC_GPIO_AD_B1_14_LPSPI3_SDO

- IOMUXC_GPIO_AD_B0_02_LPSPI3_SDI to IOMUXC_GPIO_AD_B1_13_LPSPI3_SDI

- IOMUXC_GPIO_AD_B0_03_LPSPI3_PCS0 to IOMUXC_GPIO_AD_B1_12_LPSPI3_PCS0

Then I soldered some wires on R226-R229 which are connected to GPIO_AD_B1_12-15.

The wires are connected to a raspberry pi which is used as SPI master for these test.

The pi sends frames (monitored by oscilloscope) but the i.mx rt still doesn't receive any frame or get a spi error flag.

I will just do a short test with the default pin mux tomorrow.

Greetings,

Julian

0 Kudos
1,656 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Julian,

 1. If you are using the official default pin mux

    Please note this point:Remove the resistor R334 

 2. If you are using your own pin_mux

- IOMUXC_GPIO_AD_B0_00_LPSPI3_SCK to IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK

- IOMUXC_GPIO_AD_B0_01_LPSPI3_SDO to IOMUXC_GPIO_AD_B1_14_LPSPI3_SDO

- IOMUXC_GPIO_AD_B0_02_LPSPI3_SDI to IOMUXC_GPIO_AD_B1_13_LPSPI3_SDI

- IOMUXC_GPIO_AD_B0_03_LPSPI3_PCS0 to IOMUXC_GPIO_AD_B1_12_LPSPI3_PCS0

Then, please note this point:

   remove R98,R99,R100,R101

You can use two RT1050 board, one as master, and another as slave, just use the official master and official slave code, whether it works OK on your side.

If you still have problems on your side, please let me know, then I will help you to test it.


Have a great day,
Kerry

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos