Custom board design steps

Hi,

For many reasons, I need to design my own PCB with an AVR/STM32. I need the PCB to be programmable with just a USB cable that can turn into serial monitor too from Arduino IDE in Windows. Exactly the same as the Arduino Uno or Nucleo development boards.

Solution 1-1: In Uno, there is a AT8u that should be programmed via ISP with a firmware. Then it programs the main AT8 via its Serial port by asserting DTR, because every AVR chip is shipped with a bootloader listening to its USART port. Where can I find the USB firmware?

Solution 1-2: Could I use a FTDI FT232R chip instead of AT8u and would Arduino IDE still recognize it?

Solution 1-3: If I want to get rid of the FTDI chip or AT8u, can I program an AVR chip with USB port, using ISP, with a USB bootloader that Arduino IDE recognizes?

Now same questions about STM32.

On the Nucleo dev boards, there is another STM32 that probably has a firmware that connects to PC via USB and programs another main STM32 using its SWD port. Can I have those exact chips on my PCB and program the first one through its SWD (using a STLink) with proper firmware (Where is that?), so that I can use a USB cable afterwards?

Can I use a STM32 device and program it using its SWD with a USB bootloader that takes sketches from its USB port afterwards? Where is that bootloader (for any STM32 and not just marple-mini boards? Is that programmer integrated into Arduino IDE?

I know about https://www.youtube.com/watch?v=wGbiT6IxGP0 for example, but can I use this for my own board with any STM32 device?

I need the best-solid solution. I search A LOT and I couldn't find one. Please help.

Best regards

alijoon:
In Uno, there is a AT8u that should be programmed via ISP with a firmware. Then it programs the main AT8

Please use full model numbers (e.g. ATmega8U2, ATmega328P) instead of some arbitrary abbreviation you made up. It takes less than a second to do so and can prevent a ton of wasted time due to misunderstandings.

alijoon:
Where can I find the USB firmware?

In the hardware/arduino/avr/firmwares/atmegaxxu2 folder of the Arduino IDE installation, or here:
https://github.com/arduino/ArduinoCore-avr/tree/master/firmwares/atmegaxxu2

alijoon:
Could I use a FTDI FT232R chip instead of AT8u and would Arduino IDE still recognize it?

Sure. You can use any USB to TTL serial adapter chip. Another popular choice is the WCH CH340.

alijoon:
If I want to get rid of the FTDI chip or AT8u, can I program an AVR chip with USB port, using ISP, with a USB bootloader that Arduino IDE recognizes?

Sure. That’s what the Leonardo, Micro, and Pro Micro are.

The maple mini has the bootloader on bored. of course you can do it it’s very easy
the problem is you use some of your program space for the bootloader
chances are there’s so much there you won’t even know the difference

it sounds like you have too many choices and too many options.

figure out what you want to do, measure temperature, control a drone, etc

then figure out the micro controller you want to use

programming a boot loader with a USB cable is easy enough, but it does take up memory, nothing is free. programming with a programmer requires you have a way to connect, and sometimes a switch or jumper.

there are a lot of STM32 variants so do not assume that every one uses the same STM32F103CBT6 chip. the Nucleo has a wide array of chips. STM32F207ZGT6 for example.

but it seems you are putting the cart before the horse.

figure out the hardware you require to get your work done. then find what options you have for bootloaders / firmware for the chip

if you want to stay in the Arduino environment the MapleMini board may be your best choice because it comes pre-loaded with the bootloader to be recognized by the Arduino IDE. it also has the correct resistors to be able to be programmed. the 'minimum board' cannot be used directly as it has the wrong PCB layout (for the Arduino bootloader) and you are required to modify it to allow it to be programed as if it were a MapleMini. layouts change and some may and some may not, but for less than $2, it is a good buy. the malple mini is less then $4 so you save a lot of headache for your $2.

but is the second processor there just to program the first ?