# Tag Info

55

A bootloader on a microcontroller is responsible for updating the main firmware over a communication channel other than the programming header. This is useful for updating firmware in the field over BLE, UART, I2C, SD cards, USB, etc. It would be extremely inconvenient to require customers to purchase programmers just to update the firmware on their ...

31

VDDA is not connected. Application note AN4325 Getting started with STM32F030xx and STM32F070xx series hardware development says, The VDDA supply can be equal to or higher than VDD. This allows VDD to stay low while still providing the full performance for the analog blocks. When a single supply is used, VDDA must be externally connected to VDD. So,...

26

So that the loading process can recover from errors. Suppose there is a communication error or power disconnects during an upgrade. If the boot loader were part of the application you were upgrading then the user wouldn't be able to try again without using special hardware to reflash to boot loader. Some microcontrollers can't execute code from RAM. If the ...

24

All STM32 MCUs have self-programmable flash memory. If you need to store user settings, you can store them in an area of flash. ST provides a library to perform EEPROM emulation on the STM32F4. (There are similar libraries for most of their other parts as well.) Even if you don't plan on using that library, their application note explaining how it works may ...

23

I'm not an electronics engineer, but I would go for using the TX operation as a software UART. For an RX operation, buffering is needed, and interrupts are needed not to miss information. This is typically handled by a hardware UART. For a TX operation, you only need to send information, which is happening when you want it (for receiving you don't know ...

19

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 other (strongly linked) is found. This is often used for default interrupt handlers in bare-metal MCU frameworks. This way, when you implement an interrupt, you ...

17

You misunderstand what the heap is. The heap is the area where malloc gives you blocks of RAM dynamically at run-time. Your globally scoped, statically allocated variables & arrays are not 'on the heap'. If you're not using malloc or any of its variants in your program, you can quite safely set the heap size to 0.

17

Have you looked at your power supply waveform with an oscilloscope? The LF33 linear low-dropout voltage regulator you seem to be using requires a minimum of 2µF of added output capacitance for stability, your schematic only shows 100nF. Also, I don't see any input capacitance before the regulator. If the regulator is oscillating, it could be intermittently ...

15

As you suspect, this is happening because the unsigned int data type is 4 bytes in size. Each *bss_start_p = 0; statement actually clears four bytes of the bss area. The bss memory range needs to be aligned correctly. You could simply define _BSS_START and _BSS_END so that the total size is a multiple of four, but this is usually handled by allowing the ...

14

The vertical scale on your first two oscilloscope traces (50% and 100% duty cycle) is roughly 0-3 V The vertical scale on your third oscilloscope trace (0% duty cycle) is around 0-30 mV The amplitude of the noise is thus probably the same in all the traces, but it is only obvious when magnified in the third image which is "zoomed in" by a factor of 100!

14

No way. 2 million samples of 12 bits (ADC resolution) each means 3 MBytes/second. One byte is transferred as 10 bits (8 bits data, 1 start bit, 1 stop bit), so you'd need 30 MBits/s transfer rate. The STM32F401RE MCU on the board has a maximum APB2 clock frequency of 84 MHz. The maximal UART bitrate is 1/8 of the clock, that's 10.5 MBits/s.

14

In the datasheet of any PIC there are registers and each bit of those registers are showed and explained. But in the datasheet of STM32 chips I could not find any registers. How can I find all registers in STM32 chips and specific bits of these register. The Datasheet contains the external description of the MCU, i.e. pin mappings, electrical ...

13

Is this for legacy design reasons, such as a new feature was inserted into previously reserved space? In this particular case (and in similar cases I've seen) yes, it's done to help keep backward compatibility with older devices and minimise any changes required to the (perhaps well-tested and qualified / certified) code already written for those older ...

13

They are referring to the total number of capacitors needed. ST has a useful document: "AN4325 - Getting started with STM32F030xx and STM32F070xx series hardware development" Inside, it is a bit more clear: And they explain it directly in Section 5.4:

13

You are looking at the datasheet. It is not there. It is in the reference manual. For STM32, datasheet is mostly for package specific things like pinouts and electrical specifications (that's the only time I ever look at it anyways). User reference manual is for device common things like registers and peripherals which is almost everything else.

12

There are two things wrong with your code: 1) you attempt to reset and restart the counter in the interrupt handler with "TIM1->EGR |= 0x01;" . But you're using the automatic reload mode of the counter so you shouldn't do that. 2) You never clear the interrupt from the timer. The timer sets the interrupt, but you're responsible for clearing it once you've ...

12

The BYPASS pin should be low to to enable internal regulator. Now it is high and disables internal regulator.

11

EEPROM is very expensive in terms of cell size (leading to a larger die and hence higher cost). Manufacturers started trying to get rid of EEPROM as soon as the first Flash based controllers were released. Especially when you consider the varying user requirements for the amount of EEPROM, it makes more sense to emulate in Flash, despite the limitations. As ...

11

You should reset the value of the pins you are changing before setting the bits. The reset value of GPIOA_CRL is 0x4444 4444. So each pin is initialized with 0b0100, if you do a |= 0b0011 you end up with 0b0111 which is an open drain output. Same with 0b1011 becomes 0b1111 and that is an alternate function open drain. So you need to do something like this: ...

11

They're generally there to allow you to update your main application program. You need some code which knows how to erase and reprogram some of the internal flash, that can't be the main program as when it's erased itself it wouldn't be able to reprogram.

11

It's far simpler to implement a UART transmission in software because you just bit-bang the output port until the bytes are sent. To implement a receiver, you have to do multiple checks on the bits as they arrive (such as waiting for the start bit) and parity checking and usually, you have to run at a much higher processing rate to ensure you can cope with ...

10

I can't speak about mbed specifically, but the general idea is that sleep() causes the execution of the current process to pause for some number of seconds, or indefinitely if no argument (equivalent to an argument of 0) is given. In a multiprocess environment, that means that it simply yields the CPU to other processes. If there are no other processes ...

10

That is a lot of questions... So a simple, technically functional, STM32 program: .thumb .globl _start _start: .word 0x20000100 .word reset .word 0x12345678 .word 0xAABBCCDD .thumb_func reset: nop nop nop b reset Build it and then see what we see: $arm-none-eabi-as so.s -o so.o$ arm-none-eabi-ld -Ttext=0x08000000 so.o -...

9

IF you are not aware of CMOS "buried SCR latch effect" with supply shoot-thru heat-damage effects from inputs rising greater than supplying voltage by 0.3V, you will never forget now. This is the same as applying analog signals before VddA is connected. The application note p11 clearly states what must be done , but not the reason. "• The POR monitors ...

9

In my professional experience I have found the STM32 to extremely sensitive transient voltages on the power rails and GPIO. Make sure that your power supplies aren't over-shooting on startup. On thing you can do to mitigate this is to add between 10uF and 100uF on the output of your voltages regulator. Good luck and let us know how it goes.

9

The -> operator is the structure/union pointer operator, which is definitely part of the C language. (Thanks Jeroen, see comment below). Assume you have a struct: struct { int width; int length; } Box; Box aBox; Than you can get to the properties as: int width = aBox.width; int length = aBox.length; Now assume you have a pointer to that box: Box*...

9

The bootloader allows the MCU to communicate with something else to accept a new program, store it, and run it after a reset. If you didn't have a bootloader, then a Programmer is needed to access the memory and put the program in place.

8

You can implement an RTOS and replace the HAL_Delay for the equivalent Thread_Sleep function available. But the library doesn't look very complicated, you can probably pick any of the options and do it in equal time. A secondary MCU is almost never the right answer.

8

FreeRTOS wasn't designed to support C++. https://interactive.freertos.org/hc/en-us/community/posts/210028906-Using-FreeRTOS-with-C- Since I don't see any other references to USART3_EXTI28_IRQHandler in your code, I assume there's some kind of framework (probably part of FreeRTOS) that actually requires that exact function name. So that gives me a hint that ...

7

Let's take a look into LF33 datasheet: https://www.st.com/resource/en/datasheet/cd00000546.pdf Output bypass capacitance: ESR = 0.1 to 10 Ω Io = 0 to 500 mA Minimum: 2μF, Typical: 10μF Capacitance of 100nF, far away from LDO won't do the job. Try to check power line with oscilloscope. And do not fry next MCU without adding 10-47uF LOW ESR electrolytic ...

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