S32DS 3.4 Config tools how to set SPI instance for SpiExternalDevice

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32DS 3.4 Config tools how to set SPI instance for SpiExternalDevice

ソリューションへジャンプ
1,088件の閲覧回数
tommy1231
Contributor II

I'm using an S32K344 and I'm not sure how to set which SPI instance to use for a device. How do I set this to use instance 2?

For example here is how I configured the SpiExternalDevice:

tommy1231_0-1707428383917.png

When I run the generate code the instance is set to 0

 

/* Lpspi_Ip_DeviceAttributes_SpiPhyUnit_1_LEDS Device Attribute Configuration of Spi*/
const Lpspi_Ip_ExternalDeviceType Lpspi_Ip_DeviceAttributes_SpiPhyUnit_1_LEDS_Instance_0_BOARD_InitPeripherals =
{
0U, /* Instance */
(uint32)(LPSPI_CCR_SCKPCS(1U) | LPSPI_CCR_PCSSCK(1U) | LPSPI_CCR_SCKDIV(12U) | LPSPI_CCR_DBT(0U)), /* ccr */
(uint32)(LPSPI_TCR_WIDTH(0U) | LPSPI_TCR_CPOL(0U) | LPSPI_TCR_CPHA(1U) | LPSPI_TCR_PRESCALE(0U) | LPSPI_TCR_PCS(0U) | LPSPI_TCR_CONT(1U)) /* TCR */


#if (STD_ON == LPSPI_IP_HALF_DUPLEX_MODE_SUPPORT)
,(uint32)0U /* This device do not support half duplex mode */
#endif
, &Lpspi_Ip_DeviceParamsCfg_BOARD_InitPeripherals[1U]
};

 

0 件の賞賛
返信
1 解決策
965件の閲覧回数
VaneB
NXP TechSupport
NXP TechSupport

Hi @tommy1231 

To assign the corresponding configurations to a specific SpiPhyUnit, you need to modify the SpiHwUnit parameter, as shown in the following image. 

VaneB_0-1708371794425.png

元の投稿で解決策を見る

5 返答(返信)
1,074件の閲覧回数
VaneB
NXP TechSupport
NXP TechSupport

Hi @tommy1231 

How to set which SPI instance to use for a device. How do I set this to use instance 2?

The LPSPI instances are configured in the Peripherals tool in the "SPIGeneral " tab. The SpiPhyUnit is where you configure the LPSPI instance. I suggest checking the Lpspi_Flexio_Ip_Transfer example so you can get familiar with the configurations and functionality of the driver. 

VaneB_0-1707513094903.png

B.R.

VaneB

0 件の賞賛
返信
1,072件の閲覧回数
tommy1231
Contributor II

Thank you for the feedback.  The problem is the instance also gets included in the output for the spidriver

Here it is in the mex file, which does not have anything for the instance,

                                 <setting name="Name" value="SpiExternalDevice_0"/>
                                 <setting name="SpiBaudrate" value="100000"/>
                                 <setting name="SpiCsIdentifier" value="PCS0"/>
                                 <setting name="SpiCsPolarity" value="LOW"/>
                                 <setting name="SpiDataShiftEdge" value="LEADING"/>
                                 <setting name="SpiHwUnit" value="CSIB0"/>
                                 <setting name="SpiShiftClockIdleLevel" value="HIGH"/>
                                 <setting name="SpiDataWidth" value="4"/>
                                 <setting name="SpiDefaultData" value="0"/>
                                 <setting name="SpiTransferStart" value="LSB"/>
                                 <setting name="SpiTimeClk2Cs" value="0.000001"/>
                                 <setting name="SpiTimeCs2Clk" value="0.000001"/>
                                 <setting name="SpiTimeCs2Cs" value="0.0000064"/>
                                 <setting name="SpiDeviceHalfDuplexSupport" value="false"/>
                                 <setting name="SpiTransferWidth" value="TRANSFER_1_BIT"/>
                                 <setting name="SpiHalfDuplexPinSelect" value="HALF_DUPLEX_SIN"/>
                                 <setting name="SpiCsContinous" value="TRUE"/>
 
Results in this output:

/* Lpspi_Ip_DeviceAttributes_SpiExternalDevice_0 Device Attribute Configuration of Spi*/
const Lpspi_Ip_ExternalDeviceType Lpspi_Ip_DeviceAttributes_SpiExternalDevice_0_Instance_0_BOARD_InitPeripherals =
{
0U, /* Instance */
(uint32)(LPSPI_CCR_SCKPCS(19U) | LPSPI_CCR_PCSSCK(19U) | LPSPI_CCR_SCKDIV(198U) | LPSPI_CCR_DBT(126U)), /* ccr */
(uint32)(LPSPI_TCR_WIDTH(0U) | LPSPI_TCR_CPOL(1U) | LPSPI_TCR_CPHA(1U) | LPSPI_TCR_PRESCALE(2U) | LPSPI_TCR_PCS(0U) | LPSPI_TCR_CONT(1U)) /* TCR */


#if (STD_ON == LPSPI_IP_HALF_DUPLEX_MODE_SUPPORT)
,(uint32)0U /* This device do not support half duplex mode */
#endif
, &Lpspi_Ip_DeviceParamsCfg_BOARD_InitPeripherals[0U]
};

Notice that this includes the instance. How do I set the instance?

0 件の賞賛
返信
1,036件の閲覧回数
VaneB
NXP TechSupport
NXP TechSupport

Hi @tommy1231 

Check the attached images. 

VaneB_1-1707760360424.png

VaneB_2-1707760371494.png

 

0 件の賞賛
返信
1,008件の閲覧回数
tommy1231
Contributor II

Hi VaneB,

Thank you for the response. In my case I have 2 SPI phy lines defined. How would I configure which SPI phy to attach the SPI driver configuration to? It seems to just take the first item in the phy list. I will have multiple configurations in the SPI driver and need to assign them to different SpyPhyUnit.

 

tommy1231_0-1708185249021.png

 

0 件の賞賛
返信
966件の閲覧回数
VaneB
NXP TechSupport
NXP TechSupport

Hi @tommy1231 

To assign the corresponding configurations to a specific SpiPhyUnit, you need to modify the SpiHwUnit parameter, as shown in the following image. 

VaneB_0-1708371794425.png