Set Peripheral Chip Select using custom Pin Labels

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

Set Peripheral Chip Select using custom Pin Labels

1,527 Views
aberger
Contributor V

In MCUXpresso's Config Tools, when configuring a DSPI module to use a particular pin for the Peripheral Chip Select, the drop down menu displays the custom Pin Labels I have defined in the Pin tool (see below):

pastedImage_1.png

In the generated code, I am unable to find any sort of mapping between my custom Pin Labels and the enum _dspi_which_pcs_config which is used to select the Chip Select when passing a dspi_master_config_t along to DSPI_MasterInit().  However, the generated initialization routine properly uses kDSPI_Pcs0 as the dspi_which_pcs_t, since that is somehow linked to my CS_LED pin.

Does this mapping exist explicitly somewhere (for example, through some #defines), so that the PCS can be changed during execution by using my custom Pin Labels? I could obviously manually create this by writing something like:

#define PCS_LED kDSPI_Pcs0

#define PCS_7SEG kDSPI_Pcs1

etc.

but it seems that Config Tools is already creating this mapping somewhere, I'm just unable to find it.

0 Kudos
Reply
3 Replies

1,322 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello  Andy Berger ,

Could you tell me which chip do you used, and share the whole project, thanks.

BR

Alice

0 Kudos
Reply

1,322 Views
aberger
Contributor V

Hi Alice,

I am using the MK64FN1M.

Attached is a project demonstrating my question. I have configured the pins and SPI peripheral as shown in the original post.

In the .mex file, you can see that I have chosen PCSO/SS >> [E12] CS_LED as the Peripheral Chip Select.

In the generated peripherals.c, it generates a dspi_master_config_t with the .whichPcs variable set to kDSPI_Pcs0. This is all correct.

However, I can not find a clean and clear way to change the .whichPcs during program execution using the custom labels I have provided to the pins, unless I manually go back into Config Tools to see the mapping between the pin labels, and the DSPI PCS enumeration.

0 Kudos
Reply

1,322 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Andy,

The definition of kDSPI_Pcs0 is in the file of "fsl_dspi.h":

pastedImage_1.png

and the "Label" is not used to here. About the description about Label you can have a look at this thread:

Config Tools Pin Label and Identifier  


Have a great day,
TIC

-------------------------------------------------------------------------------
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
Reply