Skip to the content
2 layers50.8 × 68.6 mmMCU Board, the printed circuit board in 3D

This is an STM32F042K6T6 based board that can be used to build sensors that communicate over a CAN bus

Size
50.8 × 68.6 mm
Copper layers
2
Thickness
1.6 mm
Parts
26
Nets
40
Pads
121
Tracks, vias
199, 0
Pours
1
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
30 Jul 2023
Updated
1 Jun 2024

Overview

MCU Board is an open-source printed circuit board by caipiblack, from the caipiblack/STM32-CAN-Bus-board repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 50.8 × 68.6 mm with 26 parts on 40 nets, routed with 199 tracks and 0 vias.

It is built around the SN65HVD230D, MC34063AD and SM24CANB-02HTG, with the SMAJ33CA and SMAJ4750A-TP among its other parts. Its parts include 6 connectors, 5 capacitors, 5 resistors, 5 diodes and 2 ICs. It belongs with the interfaces and adapters and microcontroller boards boards of this library.

Main components

5

README

README.md

STM32-CAN-Bus-board

CAN Bus shield with external power supply (12V/24V) for NUCLEO-L432KC board.

All the pins of the NUCLEO-L432KC board are available on the connectors of the shield.

The available pins provide many peripherals (ADC, SPI, I2C, GPIO and more) that can be used for many projects (IOT sensors, security sensors, automation...)

PCB Mounted

Hardware

This part describe how the schematic was made, how to mount the PCB and how to test it.

IMPORTANT: This shield require some modifications on the Nucleo board to works (due to external supply) (see after)

Kicad project

The Kicad project as been created with the version 8.0.1 of Kicad.

Most of the symbols and footprints comes from the default libraries.

The custom footprints are stored in the custom folder near the Kicad project.

Setup Kicad on Ubuntu 24.04:

text
sudo add-apt-repository ppa:kicad/kicad-8.0-releases
sudo apt update
sudo apt install kicad

The last production files are stored in the directory hardware/rev_a/fab.

Configuration of the NUCLEO-L432KC board

Some modifications are required to be able to power the Nucleo board from external 3V3 regulator (provided by the shield):

  • Remove the jumper!
  • Remove SB9.
  • Remove SB14.

After these changes:

  • The 3V3 power for the STM32 will be provided by "external power source" (the shield).
  • The debug/flash side of Nucleo board will not be powered by the "external power source" (the shield).
  • To flash or debug the Nucleo board, the Nucleo board must be connected by USB to the computer (The St-Link chip will be powered by 5V>3V regulator in the Nucleo board) AND the 3V3 power must be supplied by the shield (to power the STM32 chip).

PCB mounting instructions

PCB Mounted

Mount the components on the board:

  1. Take the PCB and fix it to the table.
  2. Put solder past on all CMS pads.
  3. Configure your hot air machine with something like this:
  • Speed: 3/8.
  • Temperature: 300°C.
  1. Solder the CMS components in this order: D4, D6, D1, D5, D2, U2, U3.
  2. Solder the other components in this order: C1, C10, C4, R4, R2, R6, R3, R5, F1, Jumper, C6, C5, L1.
  3. Mount the NUCLEO-L432KC board in the headers and solder the headers to the PCB (Doing it like this prevent issues with headers that are not perfectly vertical or parallel).
  4. Remove the nucleo board from the soldered headers.

PCB testing instructions

Testing instructions:

  • Remove the NUCLEO-L432KC board from the headers.
  • Power on the board with laboratory power supply configured at 12V with current limited to 50mA.
    • At this point the power consumption (on 12V line) should be less than 10mA.
    • Measure the voltage in the 3V3 pin and check that the voltage is around 3.3V.
  • If the previous tests pass, turn off the power and plug the NUCLEO-L432KC board in the headers then turn on the power.
    • At this point the power consumption (on 12V line) should be less than 10mA.
  • If the previous tests pass, connect the NUCLEO-L432KC board to the computer and flash it with the template project.
  • Test the CAN interface:
    • Plug a USB<>CAN device from a Linux computer to the board.
    • On the computer, execute these commands:
text
sudo apt-get install can-utils
sudo modprobe vcan
sudo ip link add dev can0 type vcan
sudo ip link set up can0 type can bitrate 250000
candump -td -a can0
  • Reset the board
  • On the candump you should see something like this:
text
 (000.000000)  can0  71D   [1]  00                        '.'

Software

This repository comes with a demo software in the software directory: This software act like a CANopen node and permits to control the LED of the NUCLEO-L432KC board.

This guide also describe how to create a project from scratch for the STM32-CAN-Bus-board board.

The LED can be controlled by writing in the object at index 0x6001. (See examples at CANopenLinux section).

Tools setup

  1. Download and install STM32CubeIDE from here
  2. (Optional) Download and install STM32CubeProg from here. (This tool can be used to only flash the NUCLEO-L432KC board without the IDE)

Compatibility issues of STM32CubeIDE with Ubuntu 24.04

There are issues with STM32CubeIDE on Ubuntu 24.04 because it has a dependecy to libncurses5 and this is not available with this version of Ubuntu.

This dependency is required by the arm-none-eabi-gdb provided by ST.

To resolve the problem:

  • Install the generic linux version of STM32CubeIDE instead of the version from .deb (as it will not check the dependency).
  • Install arm-none-eabi-gdb or gdb-multiarch and create a link to provide arm-none-eabi-gdb:
text
sudo apt install gdb-multiarch
sudo ln -s /usr/bin/gdb-multiarch /usr/bin/arm-none-eabi-gdb
  • In your project configuration Project Properties -> C/C++ Build -> Environment -> PATH add /usr/bin at the first place to use arm-none-eabi-gdb provided by /usr/bin instead of ST directories.

Create a project from scratch

Base project creation:

  1. Open STM32CubeIDE.
  2. Press File > New > STM32 Project.
  3. Press Board Selector.
  4. Search Commercial Part Number with NUCLEO-L432KC, then select it and press Next
  5. Specify the Project Name and Location, then press Finish.
  6. Configure the peripheral in defaults state and open the configuration tool (or open .ioc file).
  7. Change the configuration of PA0 to Reset_State as we don't have MCO clock source when the NUCLEO-L432KC is externaly powered from 3V3 (because MCO comes from the St-Link chip and it is not powered in this situation).
  8. In Clock Configuration:
  • Select System Clock Mux to use PLLCLK
  • Select PLL Source Mux to MSI
  • Configure the PLL with X48 and /4 to get 48Mhz in SYSCLK and APBs

For the integration of CANopenNode stack see the README of CanOpenSTM32:

  1. From configuration tool configure the CAN interface:
  • Activate CAN1
  • Activate all the interrupts of CAN1
  • Enable Automatic Bus-Off Management
  • Enable Automatic Wake-Up Mode
  • Enable Automatic Retransmission
  • Configure the Bit timing parameters, you can use this generator. The clock for CAN1 is APB1 (datasheet). In my case with a clock of 48Mhz and desired bitrate of 250Kbit/s I set:
    • Prescaler: 12
    • Time Quanta in Bit Segment 1: 13 Times
    • Time Quanta in Bit Segment 2: 2 Times
  1. From configuration tool configure a timer for CANopenNode stack:
  • Activate TIM16
  • Enable the interrupt of TIM16
  • Configure TIM16 to get 1ms. Note that TIM16 use APB2 clock. In my case with a clock of 48Mhz I set:
    • Prescaler (PSC - 16 bits value): 48-1
    • Counter Period (AutoReload Register - 16 bits value ): 1000-1
  1. Clone CanOpenSTM32 somewhere in your computer see here
  2. Take CANopenNode and CANopenNode_STM32 directories from the cloned repo and copy that in your project (from the IDE)
  3. Add CANopenNode and CANopenNode_STM32 to Source locations in Project Properties -> C/C++ General -> Paths and Symbols -> Source Locations. Then add an exclusion filter for example/ folder for CANopenNode folder
  4. Add CANopenNode and CANopenNode_STM32 to Project Properties -> C/C++ General -> Paths and Symbols -> Includes under GNU C items
  5. In your main.c, add #include "CO_app_STM32.h":
text
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "CO_app_STM32.h"
/* USER CODE END Includes */
  1. In the main.c file, call canopen_app_interrupt() when the timer ticks at 1ms:
text
/* USER CODE BEGIN 4 */
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
	  // Handle CANOpen app interrupts
	  if (htim == canopenNodeSTM32->timerHandle) {
	      canopen_app_interrupt();
	  }
}
/* USER CODE END 4 */
  1. In the main.c file, configure the CANopenNode stack and call the canopen_app_process() function in the main loop:
text
int main(void)
{
  // ...

  /* Initialize all configured peripherals */
  // ...
  /* USER CODE BEGIN 2 */
  CANopenNodeSTM32 canOpenNodeSTM32;
  canOpenNodeSTM32.CANHandle = &hcan1;
  canOpenNodeSTM32.HWInitFunction = MX_CAN1_Init;
  canOpenNodeSTM32.timerHandle = &htim16;
  canOpenNodeSTM32.desiredNodeID = 20;
  canOpenNodeSTM32.baudrate = 250;
  canopen_app_init(&canOpenNodeSTM32);
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
	  canopen_app_process();
  1. Flash the board and execute the CAN tests described in PCB testing instructions.

Configure the object dictionary

  1. Find the last release of CANopenEditor and download the binaries link
  2. Extract the release binary archive
  3. Open EDSEditor.exe with wine:
text
wine net481/EDSEditor.exe
  1. Open the file CANopenNode_STM32/DS301_profile.xpd

CANopenLinux

CANopenLinux can be used as a gateway to communicate with CANopen devices using socket/stdio commands.

Setup the CAN interface:

text
sudo apt-get install can-utils
sudo modprobe vcan
# Do it only if can0 is not already mounted!
#sudo ip link add dev can0 type vcan
sudo ip link set up can0 type can bitrate 250000

Download and install CANopenLinux:

text
git clone https://github.com/CANopenNode/CANopenLinux.git
cd CANopenLinux
git submodule update --init --recursive
make

Read an OD entry from the computer:

text
./canopend can0 -i 1 -c "stdio"
20 r 0x1000 0
[0] 34 12 00 00

Write an OD entry from the computer:

text
./canopend can0 -i 1 -c "stdio"
20 w 0x6001 0 U32 0
[0] OK

In my example, 0x6001 controls the LED!

Parts

26
QtyValueFootprintReferences
4Conn_01x15Connector_PinHeader_2.54mm:PinHeader_1x15_P2.54mm_VerticalJ1, J5, J6, J7
2100nCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mmC1, C10
210kResistor_THT:R_Axial_DIN0309_L9.0mm_D3.2mm_P2.54mm_VerticalR2, R6
10R33Resistor_THT:R_Axial_DIN0309_L9.0mm_D3.2mm_P2.54mm_VerticalR3
11000uCapacitor_THT:CP_Radial_D10.0mm_P5.00mmC6
1100uCapacitor_THT:CP_Radial_D10.0mm_P5.00mmC5
1120Resistor_THT:R_Axial_DIN0309_L9.0mm_D3.2mm_P2.54mm_VerticalR4
1470uInductor_THT:L_Radial_D8.7mm_P5.00mm_Fastron_07HCPL1
1680pCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mmC4
16k2Resistor_THT:R_Axial_DIN0309_L9.0mm_D3.2mm_P2.54mm_VerticalR5
1Buscustom:PhoenixContact_MSTBVA_2,5_4-G-5,08_1x04_P5.08mm_Vertical_customJ3
1Conn_01x02Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ2
1FuseFuse:Fuseholder_Clip-5x20mm_Littelfuse_100_Inline_P20.50x4.60mm_D1.30mm_HorizontalF1
1Jumper_2_OpenConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJP1
1MC34063ADPackage_SO:SOIC-8_3.9x4.9mm_P1.27mmU2
1PMEG4020CERXDiode_SMD:Nexperia_CFP3_SOD-123WD1
1PMEG6020CERDiode_SMD:Nexperia_CFP3_SOD-123WD5
1SM24CANB-02HTGPackage_TO_SOT_SMD:SOT-23_HandsolderingD2
1SMAJ33CADiode_SMD:D_SMAD4
1SMAJ4750ADiode_SMD:D_SMAD6
1SN65HVD230Package_SO:SOIC-8_3.9x4.9mm_P1.27mmU3

Similar boards

  • 4 layers189.4 × 59.1 mmFlippyDriver, the printed circuit board in 3D

    FlippyDriver

    NietoSkunk/FlippyDriver

    Driver board for Luminator MAX3000 Flip Dot Panels

    344 parts10MIT
  • 4 layers40 × 26.5 mmStandardModuleV2, the printed circuit board in 3D

    StandardModuleV2

    ilicmiljan/open-can-controller

    Open-source CAN bus controller for BMW E9X instrument clusters (Firmware + PCB)

    41 parts5GPL-3.0
  • 2 layers170.6 × 121.1 mmEIM, the printed circuit board in 3D

    EIM

    bhorst519/bluecar

    232 parts3
  • 2 layers125 × 78.2 mmRC ESP32 V2, the printed circuit board in 3D

    RC ESP32 V2

    Poent/RC-Snowblower

    Working on designing the impeller and auger portion of the snowblower. Switched from using a worm gear assembly to a custom ring and pinion setup using a spiral bevel gear.

    84 parts2
  • 2 layers36 × 72 mmHCP Bridge, the printed circuit board in 3D

    HCP Bridge

    JonasE99/HCP-Bridge

    🚧 WIP – not yet manufactured or tested. KiCad PCB (one per door) connecting Hörmann series 4 garage door operators (ProMatic/SupraMatic, BUS/RJ12) to Loxone via ESP32-S3 and Wi-Fi.

    53 parts1
  • 2 layers95 × 40.5 mmEsp32tester, the printed circuit board in 3D

    Esp32tester

    Lathe-Mariel/CAN

    回路 | 部品(Item) | 説明 | 数量(Qauntity) | Akizukiコード ---|---|---|---|--- U1 | ESP32-DevKitC | ESP32マイコン・ボード| 1 | 115673 IC1 | TJA1441AT | CANトランシーバ| 1 | 117464 R1, R2 | 60.4Ω 1608 | 終端抵抗 | 2 | R3, R4 | 120Ω 1608 | LED電流制限抵抗 |…

    20 parts1
  • 6 layers55 × 35 mmTACCO, the printed circuit board in 3D

    TACCO

    Stab-Rabbit-coding/Serenity-UAV

    A functional, security conscious, Unmanned Aerial Vehicle based on the Firefly Class spacecraft Serenity from the 2002 show..

    163 parts1CERN-OHL-W-2.0

Questions

How big is the MCU Board PCB?

It measures 50.8 × 68.6 mm and has 2 copper layers, 1.6 mm thick.

What parts does the MCU Board use?

26 parts, built around the SN65HVD230D, MC34063AD, SM24CANB-02HTG and SMAJ33CA. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the MCU Board KiCad files?

From the caipiblack/STM32-CAN-Bus-board repository on GitHub, at the commit this page was made from: the board is hardware/rev_a/MCU_Board.kicad_pcb and its schematic hardware/rev_a/MCU_Board.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the MCU Board design in my own project?

Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).