Problems of SPI in K60

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Problems of SPI in K60

跳至解决方案
6,720 次查看
mdrasool_yadwad
Contributor II

Hello,

     I am using SPI protocol for interfacing with the external ram 23LCV1024 with the K60 microcontroller. I am not using the Fifos directly writing the data on to the push register. K60 as the master mode with 12.5 Mhz baud and 8 bit frame . While writing on to the 23LCV1024 it is working correctly but while reading it is not giving the correct written values. I am not getting what is the problem with it can anyone please help me in this. My code is attached with this.

标签 (1)
0 项奖励
回复
1 解答
6,566 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi,

In your code, you set PCS as bellow,

     SPI->PUSHR=SPI_PUSHR_PCS(0x03)....;

Do you mean you want to set 2 PCS line simultaneously? I guess you may want to set PCS3. That should be SPI_PUSHR_PCS(1<<3).

Regards,

Jing

在原帖中查看解决方案

0 项奖励
回复
5 回复数
6,567 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi,

In your code, you set PCS as bellow,

     SPI->PUSHR=SPI_PUSHR_PCS(0x03)....;

Do you mean you want to set 2 PCS line simultaneously? I guess you may want to set PCS3. That should be SPI_PUSHR_PCS(1<<3).

Regards,

Jing

0 项奖励
回复
6,566 次查看
mdrasool_yadwad
Contributor II

Hello Jing Pan,

   Can you please explain to set that peripherals, as SPI0 is using 6 bits for setting the peripheral. 

Regards,

   Mohammedrasool 

0 项奖励
回复
6,566 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi,

Each bit in PUSHR.PCS represent a CSx signal. You can see in the enum definition in fsl_dspi.h

typedef enum _dspi_which_pcs_config
{
    kDSPI_Pcs0 = 1U << 0, /*!< Pcs[0] */
    kDSPI_Pcs1 = 1U << 1, /*!< Pcs[1] */
    kDSPI_Pcs2 = 1U << 2, /*!< Pcs[2] */
    kDSPI_Pcs3 = 1U << 3, /*!< Pcs[3] */
    kDSPI_Pcs4 = 1U << 4, /*!< Pcs[4] */
    kDSPI_Pcs5 = 1U << 5  /*!< Pcs[5] */
} dspi_which_pcs_t;

Regards,

Jing

0 项奖励
回复
6,534 次查看
mdrasool_yadwad
Contributor II

Hello Sir,

I attached document please check it once. In SPI0 the document of tower board is showing chip select 4 as Output. What does it mean we cant able to write or read 

0 项奖励
回复
6,566 次查看
mdrasool_yadwad
Contributor II

Hello Jing Pan,

   Thank you for this. I will check once again with this changes and will check whether spi is working or not.

Regards,

Mohammedrasool

0 项奖励
回复