In SX Microcontrollers, SX/B Compiler and SX-Key Tool, pakman wrote: 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, => [b]H'ED[/b]. 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, [b]=> H'3F[/b]. 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, [b]=> H'3F, H'00[/b]. 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, => [b]H'3F, H'58[/b]. 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, => [b]H'3F, H'58, H'00[/b] 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, => [b]H'3F, H'3F, H'00, H'00[/b]
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 ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=209851 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)