libftdi Archives

Subject: Re: ftdi_read_data return 0xff

From: Rodrigo Rosa <rodrigorosa.lg@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 7 Feb 2011 17:43:22 -0800
i'm not sure if numBytesToRead is correct... i don't really know what to expect. the following code:

�� �while(1)
�� �{
�� � � �// write
�� � � �numBytesToSend = 0;
�� � � �output_buff[numBytesToSend++]=0x6E;
�� � � �output_buff[numBytesToSend++]=0x01;
�� � � �output_buff[numBytesToSend++]=0x80;
�� � � �output_buff[numBytesToSend++]=0x6E;
�� � � �output_buff[numBytesToSend++]=0x01;
�� � � �output_buff[numBytesToSend++]=0x00;
�� � � �numBytesSent = ftdi_write_data(&ftdic, output_buff, numBytesToSend);

�� � � �//read
�� � � �numBytesToRead = 5;
�� � � �int i;
�� � � �for(i=0;i<10;i++)
�� � � �{
�� � � � � �input_buff[i]=0x00;
�� � � �}
�� � � �numBytesRead = ftdi_read_data(&ftdic, input_buff, numBytesToRead);
�� �}

returns:�input_buff = [0xcc, 0x33, 0x0, 0x0, 0x0 ...]
i don't understand what this means. is there any doc regarding return codes?

i hooked up a scope to TDI and i'm getting what i expected, sort of... it a square wave with 25% duty cycle, i expected 50%...

thanks!




On Mon, Feb 7, 2011 at 5:12 PM, Michael Plante <michael.plante@xxxxxxxxx> wrote:
Michael Plante wrote:
>> These do not appear to be MPSSE commands. �Have you looked at AN108? �I
am admittedly
>> looking at a year-old version. �Also, if you're sure your commands are
right, you might
>> try printing some of your variables to the console and telling us the
output, particularly
>> for numBytesToRead and numBytesRead. �I suspect you are not setting
numBytesToRead correctly, by the way.

Sorry, disregard the part about not being valid commands; I was looking at
the wrong section. �But I still think you're choosing the numBytesToRead
incorrectly.

Michael


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx




--
Rodrigo.



libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx


Current Thread