STM32F103 | STM32F103C8 Examples | Learning library
kandi X-RAY | STM32F103 Summary
kandi X-RAY | STM32F103 Summary
STM32F103C8 Examples
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 STM32F103
STM32F103 Key Features
STM32F103 Examples and Code Snippets
Community Discussions
Trending Discussions on STM32F103
QUESTION
I am trying to turn led on STM32F103 blue pill's PB1 port using bare metal assembly code. For the first step I want to initialize stack pointer in reset_handler subroutine and then execute LED related code. Enable RCC on APB2_ENR register, configure GPIO_CRL and GPIO_ODR registers respectively. The code is below, but seems that it doesn't work. Please advice what are the mistakes.
...ANSWER
Answered 2021-Dec-15 at 15:58You have mistaken loading a literal with loading from the address pointed to by the literal.
The value =rcc_apb2enr
means an address in ROM that is part of your program where you have stored the address of the register. You need to load this first, then load the value from the address pointed to by it. You can then write back to the same address.
Change the two instructions:
QUESTION
I have sim7600E on my project PCB and I am using STM32F103 to communicate with it, I have a level logic level shifter that shifts 3.3V UART down to 1.8V UART. I used a digital analyzer to confirm that the message (for example AT\r\n) is indeed arriving at the RX pin of SIM7600E. I can also confirm that the PWR signal of the module is HIGH and I have also inserted a sim card in the sim slot and the NET light is flashing.
I am quite lost because I have searched the internet for answers and couldn't find any.
Sorry for the lack of information but I really have nothing else to provide.
If anyone has had any experience with sim7600e and could provide me with some guidance it will be extremely appreciated,
...ANSWER
Answered 2021-Dec-06 at 08:59Ok so it wasn't a software issue, there was a problem with logic level converter (3.3v to 1.8v)
QUESTION
I am facing an issue with the I2C communication. During the first run the communication between the MCU and the sensor is okay then I can read and write in the sensor's registers without a problem.
However, when I try to debug a second time I receive HAL_BUSY when I am trying to communicate with the sensor, the communication is just reestablished when the power supply of the board is cut and then fed again.
The Code snippet to write to the register is the following:
...ANSWER
Answered 2021-Nov-10 at 11:43If you re-debug, your MCU is reset, but your sensor is not. Therefore, the sensor is in a state which your MCU does not expect, and the communication doesnt work. Probably, the sensor is pulling down SDA and waiting for more clock cycles to finish its transmission.
In case you don't know how I2C communication works: Both SCL and SDA lines are pulled up to Vcc. SCL should only be pulled down by the master, but all devices on the bus can pull down SDA. If multiple devices "disagree" on the status of the bus, one device might pull down SDA, while the master stops toggling SCL. This kills the bus.
You should either power cycle your system or clear the I2C bus by sending 9 clock cycles. In 9 clock cycles, any pending transmission of your sensor should be finished and you can resume your communication.
QUESTION
I am using OpenOCD to flash code into a black-pill (STM32f103). It worked a week ago but after updating ubuntu (it's the only thing I can think of that changed) it gives me an error when flashing the code.
...ANSWER
Answered 2021-Nov-04 at 15:38Since version 0.11.0 OpenOCD doesn't create the DAP(Debug Access Point) isn't automatically created. Change the line for:
QUESTION
I'm trying to figure out how to make the USB VCP functionality on my STM32F103-based Blue Pill board operate after a microcontroller reset, e.g. after uploading new code.
As I have it right now, the VCP operates normally at first, but then PuTTY ceases to report any new lines from the VCP after a hardware reset. The FTDI adapter connected to UART1
continues to work, though. Here is a minified version of main.c
:
ANSWER
Answered 2021-Oct-21 at 12:20Your MX_GPIO_Init probably initializes PA11/PA12 pins in alternate function mode for use with USB controller. Thus pulling PA12 low with WritePin will have no effect.
To force active zero on D+ first configure PA12 as regular GPIO output before (or at the beginning of) MX_GPIO_Init, and use HAL_GPIO_WritePin as written in your code. Than restore PA12 function as USB's alternate function.
QUESTION
I'm trying to figure out how to enable USB VCP functionality on my STM32F103-based Blue Pill board. In following Shawn Hymell's guide and attempting to troubleshoot with this other SO Q/A, I currently have the following (minified) main.c
: (Git Gist with full file)
ANSWER
Answered 2021-Oct-02 at 00:08Actually, my problem was far more simple than I thought. In my infinite wisdom, I decided to try this on a breadboard I'd previously been using for CANbus testing, without disconnecting the CAN circuit.
(ref)
This was never going to work, as the CANbus pins I'd been trying to use (and left plugged in) share functionality with the USB port. The VCP immediately showed up and worked after I unplugged the breadboard wires I'd connected to PA11
and PA12
. I feel dumb, but relieved, right now.
QUESTION
I have an opensource project (https://github.com/WhiteFossa/yiff-l), where I use STM32F103 MCU.
In firmware I have a lot of sprintf's with float parameters, for example:
...ANSWER
Answered 2021-May-31 at 13:42Only thing I can think of while seeing this code is that the value of power is huge:
QUESTION
I'm using STM32f103 and in my program, I need to save some bytes in the internal flash memory. But as far as I know, I have to erase a whole page to write in it, which will take time. This delay causes my display to blink. Can anybody help me to save my data without consuming so much time?
Here is a list that may help:
1- MCU: STM32f103
2- IDE: Keil vision
3- using HAL driver provided by STM32CubeMx
4- sample data for saving in Flash: {0x53, 0xa0, 0x01, 0x54}
In the link below, you can find the code that I'm using.
...ANSWER
Answered 2021-May-23 at 10:47The code you provide doesn't seem to be implemented well. It basically does 2 things each time you initiate a write operation:
- Erase the page (this is the part that takes time)
- Start form the given pointer, write until it hits a zero.
This is a very ineffective way of using the flash.
Probably the simplest and the most well-known way is to use the method described in ST's AN2594, although it has some limitations.
Still, at some point a page erase will be necessary regardless the method you use and there is no way to avoid some delay, unless your uC supports dual flash banks (STM32F103 don't have this feature). You need to plan the timing of flash writes and display refresh accordingly. If you need periodic writes to the flash, there is probably some high level error in your design.
QUESTION
I am adapting this bootloader for STM32F373CC to my device. To indicate that the device is powered but in bootloader mode, I'd like to turn on some of the status LEDs. However, this bootloader doesn't use the STM Cube MX libraries, so I have to code it low-level. The header file stm32f373xc.h is included, so I can use expressions like GPIOB_BASE.
I tried the following first thing in main(), but unfortunately it doesn't work:
...ANSWER
Answered 2021-Apr-12 at 13:15I hope that you know that open-drain outputs require pull-up (internal or external)
Use CMSIS definitions, not magic numbers and operations.
requires the entire CMSIS
And what is the problem? CMSIS does not add any overhead to your code, only handy definitions and inline functions, which do not change the size of the code if not used.
Also, HAL has very handy macros useful even if you do not use HAL library itself (it also will not increase the code size even by a single byte)
I will not check your magic offsets and numbers.
- First error: after enabling the peripheral clock you need to wait. It is described in the Reference Manual. You do not wait and your first MODER operation has no effect. HAL macros read back the register to make sure that the operation has completed.
Example from STM32L4:
QUESTION
I'm trying to change my PWM duty cycle every period from a stored buffer using a DMA. It's something very close to this topic but the code is now a little bit outdated. I'm also using the stm32l4xx_hal
implementation for my project.
What I have for now is this:
...ANSWER
Answered 2020-Jul-28 at 20:38I got mixed up with the channels of the PWM and the DMA peripheral, for anyone interested, here is a main loop that works for me:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install STM32F103
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