[JN5169 with DR1174 carrier board] The usage of SPI interface?

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

[JN5169 with DR1174 carrier board] The usage of SPI interface?

跳至解决方案
2,697 次查看
alan5_lin
Contributor III

Dear Sirs,

I tried to Read the Status Register (RDSR) of the SPI flash on DR1174 carrier board.

(In order to try the SPI interface, I did not use the flash memory API)

However, I can not get the correct response. 

Attached below are my procedures.

vAHI_SpiConfigure(0, FALSE, FALSE, FALSE, 16, FALSE, FALSE);
vAHI_SpiSelect(1);
vAHI_SpiStartTransfer8(0x05); // RDSR
vAHI_SpiWaitBusy();
u32Data = u32AHI_SpiReadTransfer32();
vAHI_SpiSelect(0);
DBG_vPrintf(TRUE, "u32Data=0x%08x\n", u32Data);

 

Why is the output value of u32Data becoming 0x000005ff?

Thanks!

0 项奖励
回复
1 解答
2,529 次查看
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alan,

vAHI_SpiSelect:

The slave-select lines are asserted immediately if “automatic slave selection” is disabled, or otherwise only during data transfers. The number of valid bits in u8SlaveMask depends on the setting of u8SlaveEnable in a previous call to vAHI_SpiConfigure().

Please look at the vLcdSendCommand_ST7565() routine, and how it is sending the SPI command. LCD_Driver.c

Regards,

Mario

在原帖中查看解决方案

6 回复数
2,529 次查看
alan5_lin
Contributor III

Hi all,

Is there any reference procedure for testing SPI interface on DR1174 carrier board?

0 项奖励
回复
2,529 次查看
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alan,

Please look at the example driver code that we provide, the example is setting a DIO0 as Slave Select

C:\NXP\bstudio_nxp\sdk\JN-SW-4170\Platform\DK4\Source\LcdDriver.c

Be sure that you are toggling in the CS.

Regards,

Mario

0 项奖励
回复
2,529 次查看
alan5_lin
Contributor III

Hi Mario,

Refer to LcdDriver.c, I put the below lines for test.

vAHI_SpiConfigure(0, FALSE, FALSE, FALSE, 16, FALSE, FALSE);
vAHI_SpiSelect(1);
vAHI_SpiStartTransfer8(0x05); // RDSR
vAHI_SpiWaitBusy();
u32Data = u32AHI_SpiReadTransfer32();
vAHI_SpiSelect(0);
DBG_vPrintf(TRUE, "u32Data=0x%08x\n", u32Data);

But it did not work on DR1174 carrier board with JN5169.

Is there any problem in my test?

0 项奖励
回复
2,529 次查看
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alan,

Are you toggling the DIO? before the vAHI_SpiSelect?

PRIVATE void vLcdRSSelect(uint8 u8Status)
{
    if (u8Status == 1)  // ON required
    {
        vAHI_DioSetOutput(LCD_RS_BIT_MASK, 0);
    }
    else {
        vAHI_DioSetOutput(0, LCD_RS_BIT_MASK);
    }
}

Regards,

Mario

0 项奖励
回复
2,529 次查看
alan5_lin
Contributor III

Dear Mario,

My test firmware is for read status register of SPI flash (M25P40) which is mounted on DR1174 carried board.

Supposed, the chip select (/SS) is toogled by vAHI_SpiSelect(1) and vAHI_SpiSelect(0)

Why can not work correctly?

Thanks

0 项奖励
回复
2,530 次查看
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alan,

vAHI_SpiSelect:

The slave-select lines are asserted immediately if “automatic slave selection” is disabled, or otherwise only during data transfers. The number of valid bits in u8SlaveMask depends on the setting of u8SlaveEnable in a previous call to vAHI_SpiConfigure().

Please look at the vLcdSendCommand_ST7565() routine, and how it is sending the SPI command. LCD_Driver.c

Regards,

Mario