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

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

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

Jump to solution
2,705 Views
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 Kudos
Reply
1 Solution
2,537 Views
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

View solution in original post

6 Replies
2,537 Views
alan5_lin
Contributor III

Hi all,

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

0 Kudos
Reply
2,537 Views
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 Kudos
Reply
2,537 Views
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 Kudos
Reply
2,537 Views
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 Kudos
Reply
2,537 Views
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 Kudos
Reply
2,538 Views
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