General Category > Discussion - Drivers

libMPSSE V1.0.3 SPI_Write

(1/1)

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

from line558~577

--- Code: ---
      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);
         
      }


--- End code ---

Why send buffer only

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


--- End code ---
 
should change to (buffer + *sizeTransferred)?

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


--- End code ---


Thanks

FTDI Community:
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 

Navigation

[0] Message Index

Go to full version