stm32f103c8 | c and c++ Makefile version | Build Tool library
kandi X-RAY | stm32f103c8 Summary
kandi X-RAY | stm32f103c8 Summary
c and c++ Makefile version
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 stm32f103c8
stm32f103c8 Key Features
stm32f103c8 Examples and Code Snippets
Community Discussions
Trending Discussions on stm32f103c8
QUESTION
Presented data retention for STM32f103c8 in its datasheet is: "1 kcycle at T = 105c: 10 years".
Can anyone explain this to me?
1- What is 1 kcycle? is it 1000 cycle (why "k" is not in capital?
2- What is a cycle? is it Write/Erase per minutes?
3- Does this sentence mean that I can use it at 105 degrees of Celsius for 10 years while I write and erase data 1000 times in each minute?
I'm putting the datasheet as a reference below.
...ANSWER
Answered 2021-May-25 at 07:48k for kilo- (meaning 1000) is always always lower case, whatever the case of what surrounds it. Eg: km = kilometre; kPa = kilopascal.
How I understand the datasheet is this:
The maximum number of times that you should erase and write this part is 10000 times.
If you erase and write the part 1000 times (1000 erases, 1000 writes) and then keep it at 85 degrees, the contents will be preserved for at least 30 years.
If you erase and write the part 1000 times (1000 erases, 1000 writes) and then keep it at 105 degrees, the contents will be preserved for at least 10 years.
If you erase and write the part 10000 times (10000 erases, 10000 writes) and then keep it at 55 degrees, the contents will be preserved for at least 20 years.
All this data is obviously predicted. The process that these parts are made by has not been around for 30 yours for them to know this for certain.
QUESTION
I come across a problem when trying to run this code in order to blink the built-in LED (located at PC13) on the blue pill board (STM32F103C8, ARM Cortex M3):
...ANSWER
Answered 2021-Apr-17 at 08:04In the uVision project configuration dialog C/C++ tab, select "use C99".
ISO C90 dies not allow declaration of variables in either a for
statement or following non -declaritive code in a statement block.
Alternatively move the declaration to the top of the statement block in which it is required. Better to use C99 though - it has been around long enough to be regarded as lowest common denominator standard I think!
QUESTION
I try to program an STM32F103C8 circuit. I use an ST-LINK V2 programmer. After running a sample of code that used special libraries, I was able to see the built-in LED ON, but now I want to program the board without using those libraries, and I don't know why I cannot see anything, the LED is OFF the whole time. Here is the code:
...ANSWER
Answered 2021-Apr-16 at 16:10Based on the info that you have the LED on PC13, I assume you're using the famous Blue Pill board. In that board, LED connection is inverted because of the special limitations of PC13 - that pin should only sink current, not source. So, in order to turn it on, you need to write 0 to corresponding bit of ODR.
Normally, I'm against the usage of magic numbers. But for STM32F103, using hex literals for GPIO configuration is practical, because one single hex digit uniquely defines the pin mode. One can memorize the meaning of hex literals for GPIO settings, and use them in a compact assignment which defines the 8 pins of a GPIO port at once. If you make GPIO configurations only once, you don't need &=
or |=
operators.
Also, prefer using BSRR
instead of ODR
, because it allows atomic modification of output pins.
Here is a LED blink example for Blue Pill board:
QUESTION
I'm using HAL_FLASHEx_Erase
on stm32f103c8.
According to datasheet, Flash memory endurance is just 10k cycles.
my data is 16 bytes so i thought method how to use flash memory like little block with counter
before i notice it erase 1 page each time.
if i erase 1 page that having 16 bytes data at front
is all other bytes in page become lose there endurance cycle even it not written?
this is method what i thought
it use next frame when it lost there endurance
frame = data(16bytes) + counter(2bytes)
page (1k bytes each) data 1 frame_pointer 2 frame1, frame2, frame3 ... 3 frame56, frame57, frame58 ... ...ANSWER
Answered 2021-Feb-15 at 09:31Indeed, the entire page needs to be erased if an existing value needs to be changed such your frame pointer. The only exception is if the value has still the initial value after erase, which is hexadecimal FF FF FF FF...
So the typical approach is to only append data until the page is full and to use the initial FF FF values to detect whether a slot has been used. In your case, it could look like so (note: I don't understand what the counter is for):
QUESTION
I'm learning low-level details of the STM32. I am puzzled by how the vector table is setup.
In the reference manual, table 63, it lists the STM32F103C8's vector table. It goes from 0x00000000
through 0x00000130
. However, if you look at the generated files from STM32CubeMX (like startup_stm32f103xb.s), you notice it only lists entries until 0x00000108
, and at this address is the magic number 0xF108F85F
, which I eventually found information about here.
Why does the generated code's vector table have fewer entries than the reference manual's vector table? Are those last few entries not actually used, or they can somehow be omitted without consequence? Position 0x108 should be the handler for interrupt "TIM5 global interrupt". I don't know what this is but why is it that somehow the magic number above can be here instead of the actual handler?
It begs a related but different question, which is that on some bare metal STM32 code, the only entries defined in the vector table are the stack pointer and the reset handler. No other handlers. What happens here? Are those interrupts disabled by default? Or is that that since those handlers are undefined, the mcu behaviour will be undefined should those interrupts occur and the code just assumes those interrupts will not happen?
...ANSWER
Answered 2020-Dec-23 at 10:11The reference manual linked is for a big family, STM32F10xxx, of devices, and each target/mcu variant in the family will have varying hardware peripheral blocks and functions. The number of maskable interrupts supported by a target vary with the available peripheral block. As such, the vector table could be then be reduced subset of the table listed for the family of devices, if a particular in the family has a reduced subset of peripherals. Consequently, everything that follows the vector table is moved up.
Looking through the product datasheet for the STM32F103C8 in specific, the peripheral blocks, as listed below, corresponding to the missing vectors are not available for the given target.
- TIM5
- UART4
- UART5
- TIM6
- TIM7
- DMA2
See table 2 in the product datasheet for an overview of the available peripheral blocks.
QUESTION
It seems that .NET (Core 3.1) supports custom curves in ECC. So I've defined the Curve25519, and generated key pair by below code:
...ANSWER
Answered 2020-Nov-30 at 16:20I don't know the libs you mention, but I do know a fair bit about curve25519
.
ECDH is of course the act of taking a counterparts public key point (really k[G]
, where k
is their private key (a clamped 256-bit
number) and G
is the curve's generator point), and multiplying it by your private key, yielding yourK * theirK * G
.
This process is commutative which is why it works when the counterpart does the same with your public key and their private key.
Now, as to why the curve parameters seemingly don't matter. curve25519
is a highly highly optimised elliptic curve crypto-system. The scalar multiplication is optimised (variable base scalar multiplication used for ECDH), the point arithmetic is optimised, etc. The multiplication is executed using only the X-coordinate
and differential additions. See here for details.
X25519
(curve25519+ECDH) exclusively uses "X-only" scalar multiplication, where points are represented only by their X
coordinate. This is one of the fastest and simplest way to do key exchange in constant time, constant time is important for side-channel timing attacks.
The only time the curve is actually needed is when we execute EdDSA
point decompression. EdDSA
points wire format is made of the Y coordinate, and the sign of the X
coordinate.
It's not that the curve is ignored, of course, elliptic curve operations must respect the underlying curve over which they operate and indeed the Galois field over which that curve is defined, it's more that the computation which is being used is guaranteed to stay on the curve by definition.
If you're zeroing all parameters, that's weird, but if you're still leaving the field (Prime
in your case), as 2^255 - 19
, this must be enough for the ECDH class to know what to do.
Thus, in short, I think it's likely not actually using the curve equation in the ECDH calculations.
QUESTION
How can the STM32F103C8 be configured to run with internal RC oscillator / HSI & PLL, i.e. without external crystal oscillator (as present on the "blue pill" board) with the Arduino framework in PlatformIO?
- https://docs.platformio.org/en/latest/boards/ststm32/bluepill_f103c8.html
- https://docs.platformio.org/en/latest/boards/ststm32/genericSTM32F103C8.html
- https://docs.platformio.org/en/latest/frameworks/arduino.html
platformio.ini:
...ANSWER
Answered 2020-Nov-03 at 13:49I dug around a bit in the PlatformIO directory.
The following paths are for "generic":
C:\Users\\.platformio\platforms\ststm32\boards\genericSTM32F103C8.json
C:\Users\\.platformio\packages\framework-arduinoststm32\variants\Generic_F103Cx\variant.cpp
Define your own system clock configuration in e.g. your main.cpp
:
QUESTION
I am trying to understand the placement of the vector table for Cortex-M3 processor.
According to the Cortex-M3 arch ref manual, the reset behavior is like this (some parts are omitted):
So, we can see that the vectortable
comes from the VTOR
(Vector Table Offset Register).
According to the Cortex-M3 tech ref manual, the VTOR
is defined as:
So we can see, it has a reset value of 0x0
. So based on the above 2 criteria, the Cortex-M3 processor expects a vector table at the absolute address 0x0 in the Code area after reset.
But in my MDK uVision IDE, I see my application is placed in the IROM1
area, which starts at 0x8000000
, which is within the 0.5G Code
memory area according to the Cortex-M3 memory map.
And since it has the Starup
button checked, I guess that means the IROM1
area should contain the vector table (please correct me if I am wrong about this).
So I think the vector table should lie at the beginning of IROM1
area, i.e. 0x8000000
. And it is indeed so. Below pic shows that at the beginning of IROM1
, it is the vector table's 1st entry, the SP value.
And what's more strange, the VTOR
register (at 0xE000ED08
) still holds a 0x0
value:
So, how could my vector table be found with a 0x0
VTOR reset value?
And just out of curiosity, I checked the memory content at 0x0
, there contains exactly the same vector table content as IROM1
. So who did this magic copy??
I guess there must be something I don't know about the startup
check box in below pic.
Thanks to @RealtimeRik and @domen. I downloaded the datasheet for STM32F103x8_xB(https://www.st.com/resource/en/datasheet/stm32f103c8.pdf). In section 4 Memory mapping, I saw below diagram:
So it seems the [0x0, 0x8000000) range does get aliased to somewhere else. But I haven't found how to determine where it is aliased to...
ADD 3 - 5:39 PM 10/9/2020Now I found it!
I downloaded the STM32Fxxx fef manual (btw it's really huge).
In section 3.4 Boot configuration, it specifies the boot mode configured through the BOOT[1:0]
pins.
And with different boot mode, different address aliasing is used:
Depending on the selected boot mode, main Flash memory, system memory or SRAM is accessible as follows:
- Boot from main Flash memory: the main Flash memory is aliased in the boot memory space (0x0000 0000), but still accessible from its original memory space (0x800 0000). In other words, the Flash memory contents can be accessed starting from address 0x0000 0000 or 0x800 0000.
- Boot from system memory: the system memory is aliased in the boot memory space (0x0000 0000), but still accessible from its original memory space (0x1FFF B000 in connectivity line devices, 0x1FFF F000 in other devices).
- Boot from the embedded SRAM: SRAM is accessible only at address 0x2000 0000.
What I saw is Boot from main Flash memory.
Well finally I can explain why 0x800 0000
is chosen...
The placement/expectation of the interrupt vector table at the address 0 is similar to the IA32 processor in real mode...
...ANSWER
Answered 2020-Oct-09 at 08:04There is no "Magic Copy". 0x00000000 is aliased to 0x08000000.
The actual memory is physically located at 0x08000000 but can also be access at 0x00000000.
If you look in the processor specific reference manual you should find this in the the memory map section.
QUESTION
For a hobby project using the stm32f1xx-hal, I'm wanting to periodically read a sensor and then push the values such that I can graph them realtime in a webUSB app.
I have found an example in webusb_blinky by mvirkkunen which demonstrates the connectivity portion, but it's not clear to me how I would adapt it to publish sensor values. Should I be overriding control_in
?
Any suggestions/help would be appreciated. Thanks!
...ANSWER
Answered 2020-Mar-23 at 18:44You could define a control transfer that requested the device respond with the current sensor values but the more natural USB mechanism for publishing sensor updates is with an IN endpoint.
The usbd-serial module is the best example I can find of creating and using endpoints with this framework. A serial port consists of both an IN and OUT endpoint for bidirectional streaming of data. For your application you would only need the IN endpoint since the device only generates data.
QUESTION
I have the following problem. Once i generate Keil project using ST CubeMX and write project into STM32F103C8 MCU, everything goes well; However, after this first flashing i'am not able to flash it anymore as it throws the following error:
...ANSWER
Answered 2020-Feb-18 at 14:22Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install stm32f103c8
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