FTDI usb-serial not working

I’m working with a FTDI usb-serial device for UART programming, and can’t get it to work with Xojo. It appears to be a real FTDI chip in the Mac System Report:

Product ID: 0x6015
Vendor ID: 0x0403 (Future Technology Devices International Limited)
Version: 10.00
Serial Number: DA008DM8
Speed: Up to 12 Mb/sec
Manufacturer: FTDI
Location ID: 0x14112000 / 9
Current Available (mA): 1000
Current Required (mA): 90
Extra Operating Current (mA): 0

I know the device works, because the chip vendor’s firmware flashing software works with it on Windows. I don’t have a way to check its function on Mac, but since it’s recognised it seems to be fine. In Xojo I can see the device and I can work with it in code, but it seems no data is sent or received. I work with Xojo on Mac but I’ve checked with Xojo on Windows too and it’s the same. The device is visible, I can work with it in Xojo, but it doesn’t work. Here’s what I’m doing:

  1. Find the device and open it with the correct baud rate, parity, stop-bit, etc.
  2. Send a byte to the device which requests a response from whatever is connected to it.
  3. Listen for the response.

The software logs everything and according to the log, everything is fine. But sending the byte is supposed to trigger a response from the connected device, and nothing is received. Checking LastErrorCode always gives 0.

I haven’t figured out a way to check if anything actually gets sent. The programmer only has 4 lines, +V, GND, TX and RX. I’m thinking a second programmer with the TX and RX pins connected to the TX and RX out of this device would let me check. Is that right?

In general, what could I be doing wrong?

Connect:
TX to RX
RX to TX

Make sure you have set all settings like XON=False, RTS=False, DTR=False and such.
Stop bits, start bits, baud rate, parity etc.
After setting Serial1.Open the port and check if it’s actually open by using the boolean return value.

Then make sure the protocol actually responds if the data you send is invalid (as it may be) (like checksum etc).
Most protocols ignore packets/data that have invalid checksums, so you won’t get ANY response!

[quote=422299:@Derk Jochems]Connect:
TX to RX
RX to TX

Make sure you have set all settings like XON=False, RTS=False, DTR=False and such.
Stop bits, start bits, baud rate, parity etc.
After setting Serial1.Open the port and check if it’s actually open by using the boolean return value.

Then make sure the protocol actually responds if the data you send is invalid (as it may be) (like checksum etc).
Most protocols ignore packets/data that have invalid checksums, so you won’t get ANY response![/quote]

Okay, thanks for the help. I’ll wire up a second programmer and see if I can test output that way. I forgot to mention I did set all those other things as specified in the vendor’s document (it is an stm32 chip). I thought I had the checksum byte in the command methods, but maybe I missed one, I’ll check it.

Assuming this is a standalone FTDI converter that is connected to the stm32 module, the simplest thing to test the FTDI converter is as @Derk Jochems stated, connect the RX pin to the TX pin on the converter. Then if you are not sure of your COM port skills just yet, use something like Coolterm or Teraterm just to verify the converter is working (i.e. what you send out is what you receive back).

If the STM32 module already has the FTDI converter integrated then use whatever application came with the module (there is always one - even for cloned stuff) and use that to test the module’s communication.

Once you’ve tested the communications are ok, then it is a matter of understanding how to properly communicate with your particular application. That in itself is the bulk of the job, but I think you are just trying to verify some/any communications are happening first.

Okay, I’ve verified that data is in fact getting sent. It’s received by a second programmer with connections TX ↔ RX to the first programmer. So it appears to be a protocol problem, which is good news.

Yes, thanks, that’s where I am now. Mechanically, it’s working. So I’m glad it’s not a Xojo issue. Looks like Xojo is working just fine here :slight_smile:

By chance has anyone here already made an stm32 programming utility?

I’m confused by having to work with the data as strings. I thought it would be bytes. So this is my first stumbling block. If I want to send a byte with value 7F, what do I send exactly? I’m sending chr( &h7F ). This must be wrong?

Paste a link to the protocol and i’ll see what i can do

Oh, thank you. I just found the problem. It was, as you guessed initially, a missing checksum! I had put it everywhere else except in this first command.

To answer my own question above, to send 7F, one does indeed send chr( &h7F ).

It’s working! Yay. :slight_smile:

Thank you guys, Derk and Langue.

[quote=422324:@Aaron Hunt]Oh, thank you. I just found the problem. It was, as you guessed initially, a missing checksum! I had put it everywhere else except in this first command.

To answer my own question above, to send 7F, one does indeed send chr( &h7F ).

It’s working! Yay. :slight_smile:

Thank you guys, Derk and Langue.[/quote]

Cheers!

Ooh you may wanna use the ChrB(), AscB(), LenB() functions instead, they are Binary instead of string (encoded). As most protocols use Nil encoding!