Shop OBEX P1 Docs P2 Docs Learn Events
FT232 sending HEx string, HELP! — Parallax Forums

FT232 sending HEx string, HELP!

PakmanPakman Posts: 1
edited 2007-08-22 00:38 in General Discussion
Hi everyone, this is my first post in this forum. Not sure is this the right session for FTDI question. Pardon me for that.

I am now evaluating the chip and ran the simple loopback·"Hello World" code sample found on·FTDI website. Sch. is simple FT232BL + eeprom + power + usb D+/D-, Loopback Tx/Rx. Everything went right.

But when I substituted the "Hello World" string with a Hex byte array, the chip did not send out the right hex data. Already in contact with FTDI tech support, but we are still batting between possibilities.

Hope someone on this forum have an idea.

Here are my findings....
Case 1, only the first byte in the array was defined, the sent out byte was correct, => H'ED.
ReDim bytText(3) As Byte
bytText(0) = &HED

If FT_Write(lngHandle, bytText, 1, lngBytesWritten) <> FT_OK Then
··· LoggerList.AddItem "Write Failed"
··· GoTo CloseHandle
End If

Case 2, just by defining the second byte, the sent out byte was WRONG, => H'3F.
ReDim bytText(3) As Byte
bytText(0) = &HED
bytText(1) = &H2D

If FT_Write(lngHandle, bytText, 1, lngBytesWritten) <> FT_OK Then
··· LoggerList.AddItem "Write Failed"
··· GoTo CloseHandle
End If

Case 3, 2 bytes were defined and 2 bytes sent, the result was wrong again, => H'3F, H'00.
ReDim bytText(3) As Byte
bytText(0) = &HED
bytText(1) = &H2D

If FT_Write(lngHandle, bytText, 2, lngBytesWritten) <> FT_OK Then
··· LoggerList.AddItem "Write Failed"
··· GoTo CloseHandle
End If


Case 4, 3 bytes were defined and 2 bytes sent, the result was wrong, => H'3F, H'58.
Surprisingly, the 3rd byte in array appeared at the 2nd byte in the sent string.
ReDim bytText(3) As Byte
bytText(0) = &HED
bytText(1) = &H2D
bytText(2) = &H58

If FT_Write(lngHandle, bytText, 2, lngBytesWritten) <> FT_OK Then
··· LoggerList.AddItem "Write Failed"
··· GoTo CloseHandle
End If


Case 5, 3 bytes were defined and 3 bytes sent, the result was wrong, => H'3F, H'58, H'00
ReDim bytText(3) As Byte
bytText(0) = &HED
bytText(1) = &H2D
bytText(2) = &H58

If FT_Write(lngHandle, bytText, 3, lngBytesWritten) <> FT_OK Then
··· LoggerList.AddItem "Write Failed"
··· GoTo CloseHandle
End If


It seemed to me the buffer array was not inline with the sent out string format. The H'3F and H'00 appeared more at the first and last byte in the sent out string. While the actual buffer content could not fit in the sent string. Here was the last case I did.
Case 6, 4 bytes were defined and 4 bytes sent, the result was completely wrong, => H'3F, H'3F, H'00, H'00
ReDim bytText(3) As Byte
bytText(0) = &HED
bytText(1) = &H2D
bytText(2) = &H58
bytText(3) = &HE4

If FT_Write(lngHandle, bytText, 4, lngBytesWritten) <> FT_OK Then
··· LoggerList.AddItem "Write Failed"
··· GoTo CloseHandle
End If


Now I am totally lost. I do not know if there should be something I am missing.
Thank you for your interest in looking at this.

Pakman
Sign In or Register to comment.