STM32F407G-DISC1 | STM32F4 microprocessor via the Embedded.fm
kandi X-RAY | STM32F407G-DISC1 Summary
kandi X-RAY | STM32F407G-DISC1 Summary
Learning to programme the STM32F4 microprocessor via the Embedded.fm tutorial series
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of STM32F407G-DISC1
STM32F407G-DISC1 Key Features
STM32F407G-DISC1 Examples and Code Snippets
Community Discussions
Trending Discussions on STM32F407G-DISC1
QUESTION
I'm trying to receive simple interrupts on my STM32F407G-DISC1, and I can't seem to configure the EXTI0 interrupt channel to receive from PE0, and instead it only seems to trigger on changes to PA0.
When I short the 3.3V pin to PA0, it prints "Interrupt Received", but when I short 3.3V to PE0, nothing happens.
Is there some configuration call I'm missing?
The build scripts and other configuration files are based off of the cortex-m quickstart, with small modifications. If those are relevant I can post those as well.
Here's my code:
...ANSWER
Answered 2019-May-19 at 19:57Apparently, the system configuration controller clock must be enabled to change syscfg registers. Adding rcc.apb2enr.modify(|_, w| w.syscfgen().enabled());
makes it work. Full source:
QUESTION
I have the following: STM32F407G-DISC1. My goal is to communicate (sending strings back and forth) between my pc and the mcu over serial and I currently am able to do so using the micro-usb (otg) port, while powering separately using the mini-usb st-link port (so using two cables).
Is it possible to use the mini-usb port for serial communications? (eliminating one of the cables)
I have read the user manual and my interpretation is that this is not possible without physical modifications. But I am a beginner and would like to verify I am correct in this interpretation. I have researched thoroughly however most sources seem to not refer to this specific board and it is my understanding with the newer version of st-link it uses this should be achievable.
...ANSWER
Answered 2018-Aug-13 at 23:49It is possible - just send the messages via the USART2
You need to solder those two wires as they screw up the design.
QUESTION
So I'm learning embedded development, and I recently learned the basics of SPI. As a project, I wanted to communicate with the LIS3DSH accelerometer on my STM32F407G-DISC1 board using only the CMSIS headers.
I pasted the entire code below, but I'll explain it first because no one wants to read all that code.
As a reference, these are the pins needed (according to the MCU's datasheet) to communicate via SPI:
- PA5 - SPI1_SCK
- PA7 - SPI1_MOSI
- PA6 - SPI1_MISO
- PE3 - CS_I2C/SPI
Here's the steps I took in my code:
- Enabled the clock for GPIOA and GPIOE using the AHB1ENR register.
- For GPIOA, I set the three pins as alternate function, output is push-pull, speed is low, no pull-up/pull-down, and configured the alternate function as SPI.
- For GPIOE, set it as GPIO mode, push-pull, low speed, pull-up, and then set it high (as in wrote to the BSSR register).
- Enabled the clock for SPI using the APB2ENR register.
- Configured SPI1: first disabled it, enabled 2-line unidirectional mode, set baud rate to fPCL/16 since the APB2 peripheral clock is 84MHz and the max clock of the accelerometer is 10MHz. Then set clock phase and polarity to 1. 8-bit data frame, MSB first, enabled software slave management, and also enabled master configuration. Finally, enabled SPI1.
- After all this, I transmit 0x63 to the 0x20 register of the accelerometer. This sets the output rate to 100Hz and enables both the x and y axis. I have no idea if this is actually working. I'm assuming it is because the TX buffer is empty when I check the SPI status register.
- Then to test whether I can recieve, I attempt to get the data from the WHO_AM_I register of the accelerometer. But I only see garbage data when I debug it (0xFF).
I've googled around to see why this may be, and a lot of people suggested that the clock polarity and phase may be incorrect. However, I've checked it multiple times, and I'm fairly certain I configured it properly.
I've tried setting interrupts. During the interrupt, even though RXNE (RX buffer not empty) is true, it still reads only 0xFF. I'm stumped as to why this is happening.
The code is below. The starting point is accelerometer_init()
. The reading of the data from the WHO_AM_I register is in turn_on_accelerometer()
.
ANSWER
Answered 2018-Jun-19 at 17:43You are working with SPI incorrectly.
This bus works in this way:
- master (MCU) sends byte in MOSI
- line at the same (!) time slave (LIS) sends byte in MISO line. In this moment slave dont know, what exactly byte master transfers to it.
To transfer one byte, you should:
- write byte in data register
- wait for completition of transfer
- read data register
Thus, to read WHO_AM_I register, we obtain next sequence:
- init SPI
- flush data register (just read SPI->DR)
- send command
- wait
- read dummy data (your 0xFF)
- write second byte (0x00 or 0xFF, it doesn't matter)
- wait
- read correct answer from LIS
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install STM32F407G-DISC1
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page