This repo is the secondary embedded system(Bluepill - STM32F103C8TX) on the shared controlled autonomous wheelchair.
The MCU does
- collect data from incremental encoder
- process them to angular velocity and
- send them back to primary MCU every 1ms.
Link to Main MCU repo: https://github.com/angcx1997/scat_microcontroller
Link to original author repo: https://github.com/angcx1997/ScatWheelchair_MCU_2
-
STM32CubeIDE > 1.7.0
All OSes: click here for installation instructions
STM32CubeIDE is used to generated the overall code and structure. In Project Manager/Code Generator, select "Generate peripheral initialization ..."
Tips: Add the code in between the section
/* USER CODE BEGIN XX */
and/* USER CODE END XX */
- Do note that the code is not generated through CubeMX but refer to the code generated by it.
- If wish to use the auto-code generation feature from CubeMX, it is advised to generate a new code from CubeMX and copy the code from this repo.
- Also, the
/Document/cubeMX_report.pdf
is just providing a reference, might not be final pin configuration or peripheral configuration.
Hardware | Peripheral Used |
---|---|
Left Encoder | TIM2 CH1 CH2 |
Right Encoder | TIM3 CH1 CH2 |
Communication with Main MCU | SPI1 |
To achieve accurate timing of 1kHz, systick interrupt is used to ensure that the data sending at correct timing.
If user have more thing to send over to main MCU, could just add them into HAL_SYSTICK_Callback
.
The reason a second MCU is used is because of insufficient space on main MCU. Therefore, current method of sending data is actually not encouraged by the author as it is more error prone to wiring or timing issue during communication between MCU. And it make debugging very difficult.