Application Development — Zephyr Project Documentation
Devicetree — Zephyr Project Documentation
Sensors
Sensors — Zephyr Project Documentation
Wiring MiCs 5524 / 6814 CMOS MEMS Gas Detection Sensor | 14core.com
MQ - 2:
MQ - 136:
MQ - 137:
<aside> ⚠️ Suggestion: BME280 (Humidity, Pressure and Temperature Sensor)
</aside>
GPIOs
General-Purpose Input/Output (GPIO) — Zephyr Project Documentation
CAN
CAN Controller — Zephyr Project Documentation
Controller Area Network (CAN) Counter — Zephyr Project Documentation
<aside> 👉 the pinctrl.dtsi for stm32 is in the modules/hal/stm32/dts/st/f4/
</aside>
<aside> 👉 the yaml file st,stm32-pinctrl.yaml details on the usage —> zephyr/dts/bindings/pinctrl/st,stm32-pinctrl.yaml
</aside>
// dts fragment
&spi2 {
status = "okay";
mcp2515_can_bus_0: can@0 {
compatible = "microchip,mcp2515";
spi-max-frequency = <1000000>;
int-gpios = <&gpiob 9 GPIO_ACTIVE_LOW>; /* D2 */
status = "okay";
reg = <0x0>;
osc-freq = <16000000>;
bus-speed = <125000>;
sjw = <1>;
sample-point = <875>;
can-transceiver {
max-bitrate = <1000000>;
};
};
};
<aside> 👉 sample-point: Type: int Sample point in permille. This param is required if segments are not given. If the sample point is given, the segments are ignored.
</aside>
<aside> 👉 sjw: Type: int required: true description: Re-synchronization jump width (ISO 11898-1)
</aside>
<aside> ⚠️ Without including proper configuration for can in prj.conf, build will fail.
</aside>
MCP2515 Datasheet:
TJA1050 Datasheet
https://robu.in/wp-content/uploads/2017/09/TJA1050.pdf
Can Module:

Buy MCP2515 CAN BUS Module Single Chip Program Routine Arduino
PWM
Example device tree fragment:
n: node {
pwms = <&pwm1 1 1000 PWM_POLARITY_NORMAL>,
<&pwm2 3 2000 PWM_POLARITY_INVERTED>;
pwm-names = "alpha", "beta";
};
Example initialization:
const struct pwm_dt_spec spec =
PWM_DT_SPEC_GET_BY_NAME(DT_NODELABEL(n), alpha);
// Initializes 'spec' to:
// {
// .dev = DEVICE_DT_GET(DT_NODELABEL(pwm1)),
// .channel = 1,
// .period = 1000,
// .flags = PWM_POLARITY_NORMAL,
// }
<aside> ⚠️ In case of blackpill you need to set up the pwm inside the corresponding timer or else it won’t compile
</aside>
&timers2 {
status = "okay";
pwm2: pwm {
status = "okay";
pinctrl-0 = <&tim2_ch1_pa0 &tim2_ch2_pa1>;
pinctrl-names = "default";
};
};
<aside> ⚠️ Some timers don’t support large period length: Timer 4,3,1 → 700 micros
</aside>
ADC
<aside> ⚠️ If any channel is already occupied by timer then there will be no analog read.
</aside>
Example dts fragment:
&adc1 {
pinctrl-0 = <&adc1_in0_pa0 &adc1_in1_pa1>;
pinctrl-names = "default";
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
The channels can then be declared under zephyr, user as io-channels phandle array.
Binding yaml for ADC:
Stepper Motor
TB6600 Stepper Motor Driver with Arduino Tutorial (3 Examples)
# dts bindings
description: Stepper motors driven by TB6600 (parent node)
compatible: "stepper-motors"
child-binding:
description: GPIO-driven dc motor (child node)
properties:
dir-gpios:
required: true
type: phandle-array
description: |
Dir pin for the motor
step-gpios:
required: true
type: phandle-array
description: |
Step pin for the motor
label:
type: string
description: |
Human readable string describing the motor.
MPU6050
MPU6050: Invensense Motion Tracking Device — Zephyr Project Documentation
WeAct Studio Black Pill V1.2 — Zephyr Project Documentation
<aside>
👉 Base dts for stmf4 is zephyr/dts/arm/st/f4/stm32f4.dtsi
</aside>

um2408-stm32h7-nucleo144-boards-mb1363-stmicroelectronics.pdf






Introduction to devicetree — Zephyr Project Documentation
<aside> ⚠️ The firmware was missing. Run the script and it should work just fine
</aside>
pushd /tmp
wget -O fx2lafw-sigrok-fx2-8ch.zip https://github.com/wuxx/nanoDLA/files/4567609/fx2lafw-sigrok-fx2-8ch.zip
unzip fx2lafw-sigrok-fx2-8ch.zip
mkdir -p ~/.local/share/sigrok-firmware/
cp -v fx2lafw-sigrok-fx2-8ch.fw ~/.local/share/sigrok-firmware/fx2lafw-cypress-fx2.fw
popd