FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: libMPSSE V1.0.3 SPI_Write  (Read 949 times)

hungnung.yang

  • Newbie
  • *
  • Posts: 1
    • View Profile
libMPSSE V1.0.3 SPI_Write
« on: March 27, 2023, 09:54:49 AM »

Hi,
I have a question about the SPI_Write in ftdi_spi.c:

from line558~577
Code: [Select]

      while(*sizeTransferred < sizeToTransfer)
      {

         CurrentXferSize = ((sizeToTransfer - *sizeTransferred) > 64*1024)? 64*1024:(sizeToTransfer - *sizeTransferred);
         /* length low byte */
         cmdBuffer[1] = (uint8)((CurrentXferSize-1) & 0x000000FF);
         /* length high byte */
         cmdBuffer[2] = (uint8)(((CurrentXferSize-1) & 0x0000FF00)>>8;
         /* write command */
         status = FT_Channel_Write(SPI, handle, 3, cmdBuffer,\
            &noOfBytesTransferred);
         CHECK_STATUS(status);
         /* write data */
         status = FT_Channel_Write(SPI, handle, CurrentXferSize, buffer,\
            &noOfBytesTransferred);
         *sizeTransferred += noOfBytesTransferred;
         
         CHECK_STATUS(status);
         
      }


Why send buffer only
Code: [Select]

/* write data */
         status = FT_Channel_Write(SPI, handle, CurrentXferSize, buffer,\
            &noOfBytesTransferred);

 
should change to (buffer + *sizeTransferred)?
Code: [Select]

/* write data */
         status = FT_Channel_Write(SPI, handle, CurrentXferSize, (buffer + *sizeTransferred),\
            &noOfBytesTransferred);



Thanks

Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 866
    • View Profile
Re: libMPSSE V1.0.3 SPI_Write
« Reply #1 on: April 27, 2023, 04:52:42 PM »

Hi,
Our LibMPSSE source code is provided on the FTDI website if you want to make changes.
https://ftdichip.com/software-examples/mpsse-projects/

You could also choose not to use LibMPSSE and use d2xx direct. (See AN_108)
https://ftdichip.com/wp-content/uploads/2020/08/AN_108_Command_Processor_for_MPSSE_and_MCU_Host_Bus_Emulation_Modes.pdf

Regards
FTDI Community 
Logged