Step1 - setup of 2 second pulse:
Please refer to my previous video for setup of 2 second period pulse using stm32F407G.
https://youtu.be/DJSr8ssFJLQ
Pulse generated:
Pulse generated:
Step2 - Prepare of python code for raspberry pi:
Type the code at python IDE raspberry pi. I am using edge triggered method and detect the rising edge of signal sent by STM32. I am assign the detection to pin 40 of raspberry pi.
Python Code:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(40,GPIO.IN)
num=0
while(1):
GPIO.wait_for_edge(40,GPIO.RISING)
print(str(num))
num=num+1
Step3 - Board connection STM32 and raspberry pi:
Common ground is needed to synchronize the signal between STM32 & raspberry pi.
STM32 raspberry pi
PE9 --> pin40
GND--> GND
Step4 - Done:
Each triggered python program increased by 1. e.g. 1,2.3.......