multiple spi buses

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

multiple spi buses

1,330 Views
richard_clouse
Contributor II

i have an s32k148 eval board and I'm trying to use 2 spi masters from it to talk to 2 seperate buses. I used processor expert to configure lpspi1 just like the lpspi0. i'm using the lpspi_transfer example. the chip select for lpspi1 is not coming down. I made them active low because I am talking to mcp23s17 expanders as slaves. lpspi0 works but chip select is not coming down for lpspi1. I am using the wiring called out in the example except I'm going to 2 seperate busses using the same pins from the example. does anyone know this code well enough to debug where chip select is pulled down? I can't even find it.

0 Kudos
5 Replies

1,208 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Which pin are you using for the PSC of LPSPI1?

And which PSC have you selected in PE?

pastedImage_1.png

Have you configured the pin in the PIN Driver configuration?

pastedImage_2.png

Thanks,

BR, Daniel

0 Kudos

1,208 Views
richard_clouse
Contributor II

Thank you Daniel so much for the response. I changed the PCS to 0 and it works. I thought it had to match the instance number 1.

I do not know how to get to the Master Configurations/Configurations list in your screen shot.

I just added these 2 master configs types to the main(copied from send.c) and started changing things.

const lpspi_master_config_t MasterConfig0 = {

.bitsPerSec = 50000U,

.whichPcs = LPSPI_PCS0, //changed

.pcsPolarity = LPSPI_ACTIVE_LOW, //changed

.isPcsContinuous = true, //changed

.bitcount = 8U,

.lpspiSrcClk = 48000000U,

.clkPhase = LPSPI_CLOCK_PHASE_1ST_EDGE,

.clkPolarity = LPSPI_SCK_ACTIVE_HIGH,

.lsbFirst = false,

.transferType = LPSPI_USING_INTERRUPTS,

.rxDMAChannel = 255,

.txDMAChannel = 255,

.callback = NULL,

.callbackParam = NULL,

};

const lpspi_master_config_t MasterConfig1 = {

.bitsPerSec = 50000U,

.whichPcs = LPSPI_PCS0, //changed

.pcsPolarity = LPSPI_ACTIVE_LOW, //changed

.isPcsContinuous = true, //changed

.bitcount = 8U,

.lpspiSrcClk = 48000000U,

.clkPhase = LPSPI_CLOCK_PHASE_1ST_EDGE,

.clkPolarity = LPSPI_SCK_ACTIVE_HIGH,

.lsbFirst = false,

.transferType = LPSPI_USING_INTERRUPTS,

.rxDMAChannel = 255,

.txDMAChannel = 255,

.callback = NULL,

.callbackParam = NULL,

};

I know this is wrong but I’m trying to learn how to use processor expert.

Now all my signals look right but I’m not getting my receiveData variable filled when I do a read.

I’m just sending bytes to and expander and reading them back.

Any suggestions? I’d rather configure these masters from processor expert.

If I don’t hear back from you I will post another question today.

Again thank you. I’m desperate and running out of time.

<http://www.te.com/>

Richard Clouse

Software Engineer

Global Aerospace Defense and Marine - Kilovac

TEL +1 805-220-2034 MOBILE +1 480-213-9259 EMAIL richard.clouse@te.com<mailto:richard.clouse@te.com>

<https://www.facebook.com/teconnectivity> <https://twitter.com/teconnectivity> <http://instagram.com/teconnectivity> <https://www.linkedin.com/company/te-connectivity> <https://www.youtube.com/teconnectivity>

te.com<http://www.te.com/>

Click to read<http://www.te.com/global-en/private/te-email-confidentiality-statement.html> email confidentiality disclaimer.

0 Kudos

1,208 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Richard,

Please use the PE component inspector, it should be intuitive.

Just open the PE views

pastedImage_1.png

Add modules

pastedImage_4.png

Configure them in the component inspector

pastedImage_5.png

Generate the code:

pastedImage_6.png

Drag and drop functions in the code:

pastedImage_7.png

Similarly for other peripherals.

Please refer to the SDK documentation in the SDK installation folder:

...\NXP\S32DS_ARM_v2018.R1\S32DS\S32SDK_S32K1xx_RTM_3.0.0\doc\Start_here.html

Regards,

Daniel

0 Kudos

1,208 Views
richard_clouse
Contributor II

How do I configure 1 bus to both send and receive?

Do I add a configuration to the list or is it in the config?

I’m afraid I don’t know much about spi busses. I would appreciate a hint.

The problem is when I try to ‘receive’ one byte I have to use a 32 bit variable and it is shifted left 16 bits. Are there 2 dummy bytes. I can live with that but it doesn’t seem right.

<http://www.te.com/>

Richard Clouse

Software Engineer

Global Aerospace Defense and Marine - Kilovac

TEL +1 805-220-2034 MOBILE +1 480-213-9259 EMAIL richard.clouse@te.com<mailto:richard.clouse@te.com>

<https://www.facebook.com/teconnectivity> <https://twitter.com/teconnectivity> <http://instagram.com/teconnectivity> <https://www.linkedin.com/company/te-connectivity> <https://www.youtube.com/teconnectivity>

te.com<http://www.te.com/>

Click to read<http://www.te.com/global-en/private/te-email-confidentiality-statement.html> email confidentiality disclaimer.

0 Kudos

1,208 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

There can be one SDK components for each LPSPI module.

And each LPSPI module has dedicated pins that can be used.

Please refer to S32K148_IO_Signal_Description_Input_Multiplexing.xlsx file that is attached to the reference manual.

However, one SDK component can have several configurations with different frame length as well.

pastedImage_1.png

BR, Daniel

0 Kudos