Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI_ReadWrite returned unexpected result #56

Open
GoogleCodeExporter opened this issue Mar 3, 2016 · 2 comments
Open

SPI_ReadWrite returned unexpected result #56

GoogleCodeExporter opened this issue Mar 3, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

1. Linux Ubuntu (32-bit) 14.04LTS on VMware Win7 x64 host.
2. Single FT2232H Mini Module
3. Init the channel as,
    channelConf.ClockRate = 1000000;    // 1MHz
    channelConf.LatencyTimer = latency;
    channelConf.configOptions = SPI_CONFIG_OPTION_MODE0 | SPI_CONFIG_OPTION_CS_DBUS3 | SPI_CONFIG_OPTION_CS_ACTIVELOW;
    channelConf.Pin = 0x00000000;/*FinalVal-FinalDir-InitVal-InitDir (for dir 0=in, 1=out)*/
4. Use SPI_ReadWrite to do 4-byte transaction.

uint8_t LCD_RegRead(uint8_t addr) {
    uint32_t  sizeToTransfer = 0;
    uint32_t  sizeTransfered=0;
    FT_STATUS status;
    uint8_t inBuf[4], outBuf[4];

    sizeToTransfer=4;
    sizeTransfered=0;
    outBuf[0]=0x80;/* RS=1(cmd, status), RW=0(write) */
    outBuf[1]=addr;
    outBuf[2]=0x40;/* RS=0(data), RW=1(read) */
    outBuf[3]=0x00;
    inBuf[0] = 0x00;
    inBuf[1] = 0x00;
    inBuf[2] = 0x00;
    inBuf[3] = 0x00;
    status = SPI_ReadWrite(ftHandle, inBuf, outBuf, sizeToTransfer, &sizeTransfered,
        SPI_TRANSFER_OPTIONS_SIZE_IN_BYTES|
        SPI_TRANSFER_OPTIONS_CHIPSELECT_ENABLE|
        SPI_TRANSFER_OPTIONS_CHIPSELECT_DISABLE);
    APP_CHECK_STATUS(status);

    printf("inBuf=%02X%02X%02X%02X\n", inBuf[0], inBuf[1], inBuf[2], inBuf[3]);
    return inBuf[3];
}


What is the expected output? What do you see instead?

Scope capture shows consistent result on DI line but the inBuf readings are 
random each time and never returns the right value.


What version of the product are you using? On what operating system?

Shown in step 1 above.

Please provide any additional information below.

Tried different clock speed but makes no difference.


Original issue reported on code.google.com by [email protected] on 22 May 2015 at 4:54

@GoogleCodeExporter
Copy link
Author

Sample results,

inBuf=FFFFFFFF
inBuf=32603260
inBuf=FFFFFFFF
inBuf=3260FFFF
inBuf=32603260

Also attached is the connection chart on FT2232H Mini module

Original comment by [email protected] on 22 May 2015 at 5:05

Attachments:

@GoogleCodeExporter
Copy link
Author

Sorry I posted this issue at wrong place. It is the official libMPSSE-SPI 
library instead. Please feel free to close it.

Original comment by [email protected] on 22 May 2015 at 5:12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant