Rodrigo Rosa wrote: >> // 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);
I am not as sure on the 0x6E as I could have been on the 0x1A and 0x2E. You'll note the docs say that 0x1A's length is actually length-1, and measured in bits, rather than bytes. Ditto 0x2E. But it's not clear on 0x6E what "length" represents in the docs. Did you ever go look at AN108? You really need to read that before you go any further; MPSSE is not as straightforward on the host side as some other modes are. Anyway, you'll need to experiment some. And synchronize by intentionally sending bad commands periodically (FTCSPI does this, and so does my code). I will sometimes send 0xAA and expect 0xFA,0xAA, and then the same with 0xAB. Then you just read until you can't read anymore, and make sure you find where it told you "bad command". In any case, try calling ftdi_read_data() and ask for more data than you expect back, at least until you get the hang of what to ACTUALLY expect. >> returns: input_buff = [0xcc, 0x33, 0x0, 0x0, 0x0 ...] After how many iterations through the loop? Did the read ever time out, maybe just sometimes? Have you checked that there isn't more data available? Do you know that it's not returning what it should? Why is it in a loop, and how do you know there's not more data waiting to be read at the end of each loop (or less)? >> i don't understand what this means. is there any doc regarding return codes? input_buff cannot properly be called a return code, so maybe that's why you're having trouble finding it? However many bytes numBytesRead is (which you STILL haven't told me) is how many bytes of input_buff was read out of the FTDI's FIFO, which in turn come off the wire. But how that corresponds to the number of bits is something I'm not as familiar with because I always ran MPSSE such that it counted bytes rather than bits (it was still serial, but only granular to the nearest 8 bits). >> 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%... You need to measure period, too. And also say how you configured the divisor. Regards, Michael -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected]
