I am designing a PCB based on STM32F446 and I want to include CAN BUS communication. I know I need a transceiver (from CAN_H and CAN_L to TX and RX) and a CAN Controller. I have thought about MCP2551 (transceiver) and MCP2515 (controller; from TX_CAN and RX_CAN to SPI). The thing is that I am a bit loss about if this components are a good choice, or not, as I am a bit loss about if this are TTL or CMOS and which technology should I use with STM32F4.
You don't need a CAN controller. The STM32F446 already features two integrated CAN controllers (bxCAN1, bxCAN2). You only need a CAN controller when the MCU doesn't have an integrated CAN controller, or it doesn't support the features you need (CAN FD for example).
The MCP2551 transceiver is a bit dated, but it would work:
- The CAN RX/TX pins of the STM32F446 are 5V tolerant
- The MCP2551 TXD input is 3.3V compatible
Is there a specific reason you don't want to use the two CAN controllers already in the STM32F446? Then all you need is a 3V CAN transceiver. Job done.
As for TTL or CMOS, why would that be a consideration? I'd suggest finding much in TTL these days would be difficult - especially CAN controllers as I don't think they were ever TTL, maybe NMOS then CMOS.
Nobody uses external CAN controllers since some 20+ years back unless you have very specific reasons not to pick a MCU with an internal controller. You did pick such a MCU, so using MCP2515 is senseless.
Also when specifying any part in general, we start by checking the part status. https://www.microchip.com/en-us/product/MCP2551. It says "not recommended for new designs", since this is an older generation of transceivers.
2 generations later, we end up with Microchip's recommended parts, which would be MCP2561FD or MCP2562FD. These are mostly compatible with the old MCP2551 but far more rugged. The 2561 supports a "split" function on pin 5 for higher baudrates (CANFD) whereas the 2562 replaces this pin 5 with a Vio for supplying the logic levels separately (3V3 logic).
Additionally the STM32F got 3 to 5V tolerance.
So from here on you need to figure out if you wish to use 3.3V or 5V supply. There's other transceivers that can be used for 3.3V supply if you wish to keep everything purely at 3.3V level. I don't really recommend that unless your BOM is tight though.