FX3 USB SPI support 10bit Address and 8bit Data example code from cyfxusbspiregmode example code

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
cumac_1314066
Level 1
Level 1

Hi all,

We need FX3 USB SPI support 10bit Address and 8bit Data example code from cyfxusbspiregmode example code.

Could you provide us the example code for not byte alignment address format??

We would appreciate your help with this.

0 Likes
1 Solution

Hello,

Yes, the word length can be modified to suit the 10bit data transfer. Also, it has to be noted that while using CyFxSpiTransmitWords() API, the data buffer must be padded up to the next nearest byte (16-bits in your case) and the byte count must be set to next higher value (2 in your case)

Best regards,

Srinath S

View solution in original post

0 Likes
6 Replies
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

Please let me know what address are you referring to here. Is it the internal address of the SPI flash device or is it something else. Kindly, let me know about your SPI device.

Best regards,

Srinath S

0 Likes

It's not for SPI Flash. It used to control a slave device with SPI.  The device use 10-bit addresses and 8-bit data.

0 Likes

Hello,

SPI does not use addressing for the device on its whole rather it uses the SS lines. It is only the internal addressing that may be needed in case of Flash devices. Please let me know what addressing you are referring to. Is it an internal address to the device?

Best regards,

Srinath S

0 Likes

I know this controller is a single-master controller with a single automated SSN control.

We want to use FX3-SPI for control a device with 10-bit address and 8bit data.

The tenth bit sent by the master indicates the type of transfer: high for a write command , low for a read command.

And most significant bit first.

Could FX3 support 10-bit address and 8bit data SPI format??

How to config for it?

0 Likes

Could we change the "spiConfig.wordLen" for the different data bits(10-bit/8bit) of the following example code ??

/* SPI initialization for application. */

CyU3PReturnStatus_t

CyFxSpiInit (uint32_t clk, uint8_t len)

{

    CyU3PSpiConfig_t spiConfig;

    CyU3PReturnStatus_t status = CY_U3P_SUCCESS;

    /* Start the SPI module and configure the master. */

    status = CyU3PSpiInit();

    if (status != CY_U3P_SUCCESS)

    {

        return status;

    }

    /* Start the SPI master block. Run the SPI clock at 8MHz

     * and configure the word length to 8 bits. Also configure

     * the slave select using FW. */

    CyU3PMemSet ((uint8_t *)&spiConfig, 0, sizeof(spiConfig));

    spiConfig.isLsbFirst = CyFalse;

    spiConfig.cpol       = CyTrue;

    spiConfig.ssnPol     = CyFalse;

    spiConfig.cpha       = CyTrue;

    spiConfig.leadTime   = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK;

    spiConfig.lagTime    = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK;

    spiConfig.ssnCtrl    = CY_U3P_SPI_SSN_CTRL_FW;

    spiConfig.clock      = clk;//8000000 = 8MHz

    spiConfig.wordLen    = len;

    status = CyU3PSpiSetConfig (&spiConfig, NULL);

    return status;

}

0 Likes

Hello,

Yes, the word length can be modified to suit the 10bit data transfer. Also, it has to be noted that while using CyFxSpiTransmitWords() API, the data buffer must be padded up to the next nearest byte (16-bits in your case) and the byte count must be set to next higher value (2 in your case)

Best regards,

Srinath S

0 Likes