Skip to main content
21 votes
Accepted

What's the difference between setting SysTick Interrupt in NVIC and using it as an exception?

A couple of definitions first: In the Cortex-M programming manual, an Exception is anything that breaks the normal program flow, and invokes a handler from the vector table, and Interrupts are a ...
followed Monica to Codidact's user avatar
20 votes
Accepted

What does [WEAK] mean in STM32 startup assembly code?

It says the implementation of the function should be weakly linked (as opposed to strongly linked, which is the usual). This allows providing a "fallback" implementation of a function, in case no ...
dim's user avatar
  • 16.1k
15 votes
Accepted

How to calculate overflow in ARM mathematical operations

Add the two numbers together and truncate to the lower (right) 32 bits or 8 nibbles. So 0x80000000 + 0x80000000 = 0x100000000, we then truncate and we have 0x00000000 left in the 32-bit register (so ...
Spehro Pefhany's user avatar
14 votes
Accepted

STM32 RTC freeze when power is off

I want to use internal RTC Calendar with internal Clock(LSI). It's not going to work. From the Reference Manual 4.1.3 Battery backup domain Backup domain description To retain the ...
followed Monica to Codidact's user avatar
14 votes

How to calculate overflow in ARM mathematical operations

In most modern circumstances (it wasn't always so easy to say this), the part of the ALU that performs addition and subtraction is fundamentally agnostic about signed and unsigned operations. It doesn'...
jonk's user avatar
  • 78.3k
11 votes
Accepted

STM32 interrupts and C++ don't go well together

I've been searching for a solution for half a day, only to find it a few minutes after I posted this question. The answer is given by this post: Bug in Keil ARM compiler with interrupt handlers and C+...
John's user avatar
  • 1,401
10 votes

STM32 RTC freeze when power is off

I want to use internal RTC Calendar with internal Clock(LSI). I think that's why it doesn't work. According to the AN4759 Using hardware real-time clock (RTC) in low-power modes with STM32 ...
vionyst's user avatar
  • 856
7 votes

How can I find the current position of the stack without a stack pointer in micro controller programming?

As noted in the comments, not using the stack pointer when there is one is really silly and nobody would ever do it in real life. Just like writing a FizzBuzz program. Yes, you do need knowledge of ...
Fritz's user avatar
  • 768
6 votes

How to solve Keil compiler 'Error: L6218E: Undefined symbol' on STM32

Well you define ext0 but try to use ex0. No wonder linking fails.
Justme's user avatar
  • 154k
6 votes

IEEE-754 Floating Point Converter

Wikipedia has a nice page on the floating point format (the various IEEE-754 ones). 0x41100000 0b010000010001000000.... 0 10000010 001000000.... Implied 1 0 10000010 1.001000000.... 0x82 = 130 0 130 1....
old_timer's user avatar
  • 8,273
6 votes
Accepted

Expected a "," Error in keil

Compiler does not seem to support 0b prefix for entering numbers in binary. You need to convert it to something else, like hex or decimal.
Justme's user avatar
  • 154k
6 votes

C preprocessor problem in KEIL

You are telling to print an integer variable but then you pass a float variable for printing. They are not compatible. A good compiler would warn about such things which would alarm you from doing ...
Justme's user avatar
  • 154k
6 votes

C preprocessor problem in KEIL

C is very much not strongly typed. When you say printf("%ld", foo);, you are telling the printf function "here is a mess of bits which you should ...
TimWescott's user avatar
  • 46.6k
5 votes

Keil debugger exits automatically

This is a known bug in Keil. It is related to Keil's registry entries. The bug-fix is described here: RegistryFix for Keil Debugger
manishrravula's user avatar
5 votes
Accepted

Two switches and two LEDs using 8051

The code may incorrectly assume buttons being active low if they actually are active high. The code can't know that, it just looks at the bit value and it may be incorrect. But that is how the code ...
Justme's user avatar
  • 154k
4 votes

What's the difference between setting SysTick Interrupt in NVIC and using it as an exception?

The fundamental difference between the systick and peripheral interrupts is that the systick is specified by ARM to be at IRQ 6 (0x003C) when it is available in the core. It is also part of the ARM ...
Jeroen3's user avatar
  • 23.1k
4 votes
Accepted

FatFs f_write not working in LPC1788 Timer ISR

It is usually a very, very bad idea to use FatFS from interrupts. The most common pattern is to acquire the data in the ISR, store is somewhere and have a main loop task that stores that queued data ...
filo's user avatar
  • 9,036
4 votes
Accepted

Placing a key variable in internal flash Memory

secretkey.c: const long secret_key[3] __attribute__((used)) = {0xABABABAB,0xCDCDCDCD, 0xEFEFEFEF}; __attribute__((used)) to ...
Jeroen3's user avatar
  • 23.1k
4 votes

can someone explain me this error #error 35 #error directive

The code has an #error directive, explicitly telling the preprocessor to throw an error if it hits the line. These are put in by the programmer, reminding you that ...
Jeroen3's user avatar
  • 23.1k
4 votes
Accepted

Chip Erase vs. Sector Erase

Erasing the full chip would be faster, but if you need to retain part of the contents (for example, if you have a custom bootloader or some data stored at a particular address) then you can erase ...
Chris Stratton's user avatar
4 votes

How to solve Keil compiler 'Error: L6218E: Undefined symbol' on STM32

Some remarks: About your problem: You made a typo, you use ex0 while you mean ext0. It is always good practice to initialize ...
Michel Keijzers's user avatar
4 votes
Accepted

How to upgrade StdPeriph drivers for STM32F103 project

If it ain't broke, don't fix it. The StdPeriph drivers work very well on existing STM32 MCUs, and these are going stay around for a while, as long as ST renews its 10 years longevity promise every ...
followed Monica to Codidact's user avatar
4 votes

Measuring capacitance with STM32

You have the GPIO going to the capacitor through a 1 Meg resistor, and then you've connected the ADC input to it. What is the impedance of the ADC input? If I read the datasheet correctly it is 50 k. ...
GodJihyo's user avatar
  • 24.4k
4 votes
Accepted

Why does Ethernet stop working if the value of Ethernet DMA control registers refers to CCM memory?

The CCM memory is not in the list of supported DMA memory targets for Ethernet. Or any other DMA access. The CCM is not part of bus matrix and can only be accessed by CPU.
Justme's user avatar
  • 154k
3 votes

FatFs f_write not working in LPC1788 Timer ISR

+1 for @filo, who correctly addressed the problem of nested interrupts either not enabled (or having the same priority, therefore not being triggered). However the problem is not with the SPI (which ...
next-hack's user avatar
  • 5,367
3 votes
Accepted

Is function in struct efficient in c?

You are breaking a couple of things by doing this that may or may not matter. First the linkers ability to drop unused functions goes away because the address of all functions is taken even if they ...
Dan Mills's user avatar
  • 17.6k
3 votes
Accepted

TI TM4C1294XL Programming Issue

This is because of the way how driverlib GPIOPinWrite function works. ...
Andrejs Gasilovs's user avatar
3 votes
Accepted

How to set up Keil Logic Analyzer to read specific pin?

The following worked for me: (port0 & 0x00000400) >> 10 This specifies an AND mask for the signal value on port 0, while shifting by 10. Important to set the Logic Analyzer functionality as <...
rrz0's user avatar
  • 1,191
3 votes
Accepted

single or multiple interrupt handlers in stm32

Some fellows told me that stm32 have single interrupt handler routine. Definitely false. Look up the Interrupts and Events chapter in the Reference Manual, there are about 60 interrupt handlers. ...
followed Monica to Codidact's user avatar
3 votes

STM32f103 and St-link

Please read the datasheet. Refer to external click crystal HSE characteristics.
User323693's user avatar
  • 9,321

Only top scored, non community-wiki answers of a minimum length are eligible