FTDI/MCU design question to detect boot mode

atmegaavrftdipower supplyusb

MCU(ATMega 8 series) on my device has two operating modes

  1. Bootloader mode
  2. Normal operation

The firmware can be upgraded through MCU USART interface. To connect to PC I want to place FT232RL between PC and MCU. Device is normally powered up from external car power supply. During startup, MCU is checking certain GPIO pin and decides whether to enter bootloader mode or start normally. The question is what is the proper way to connect power bus of my device and USB/FT232 in order to have some output pin on FT232, which can be connected to MCU boot mode detection pin? That pin should have steady value once MCU/FT232 powered on from

  1. External power supply
  2. USB power

Basically there are 4 components a) MCU b) FT232 c) USB power bus d) External power bus

One power source is connected at the same time. I'm not sure if having one common power bus is good idea. Also I initially thought FT232 #PWREN pin can be connected to MCU for boot mode detection, but not sure if it will give me steady value.

Update:

enter image description here
When USB is connected, MCU PB2 will have logical 1. When 12V is connected, MCU will have 0. Can this work or I missed something?

Best Answer

I recommend you verify with FTDI datasheet as well as their support pages (they have a decent knowledge base). I have done a similar design:

You can use any of the CBUS pins of the FT232 to connect to the nBootmode pin of your chip. If the signal is the wrong way, then you can program the FT232 EEPROM to invert it. This means as FT232 powers up, it'll set those pins. You might want to employ a similar thing with nReset of your MCU, that way it'll remain in reset mode until FT232 is up and ready.

You'll likely need to manage separating the power bus using diodes such as a BAT54C or schottky diodes likes this: This one uses schottkys

Think about what would happen if both power ports are [accidentally] plugged in.

Regarding the PWREN#. It is meant for shutting down power of an external chip during USB suspend. It might be tricky in this case since it is low during USB enum, but it only goes high again during USB suspend which might prevent you from interacting with MCU. You might want use a generic CBUS IO and flick it up or down using the driver or one of the UART lines, etc.

Finally, most FT232 chips can't supply more than 50mA of current. Check that your MCU power requirement is lower.

Related Topic