New answers tagged

0

In addition to the missing Rext resistor, you have grounded the latch pin (LE/DM1) so you can't load data to the device. Please look up the datasheet how you want to connect it (maybe control from MCU when to load data in, or maybe it can be set high to act as a transparent latch as it is the only device on bus). Also, I see no bypass caps at supply pins ...


0

add Pin 15 R-EXT to 0V sets the CC per segment 5mA may be adequate or 10mA with a dark red flat film cover for better contrast. Output current (mA) 3 5 10 20 50 80 130 Rext (Ω ) 6740 3930 1913 963 386 241 124 ............................^ With 0.35 RdsOn @ 3.3V and 8 segments ON @ 10mA or IR=80mA*0.35Ω = 0.028V , the Anode drop is OK.


0

System Clock is clocked by AHB bus divided by 8. So simply divide the result by 8. Or better yet, when you currently multiply by 8000, multiply only by 1000.


1

Yes, shorting a capacitor with a button does cause a large pulse of current. In fact, AVR hardware design guide suggests that when a push button with contact bounce and reset capacitor is combined with stray inductance from wires and PCB traces, the surge voltages can be out of specs for the reset pin and thus a 330R series resistor is recommended. Also the ...


3

I figured it out. NVIC->ISER[0] |= TIM2_IRQn; should be NVIC->ISER[0] = 1UL << TIM2_IRQn; because to enable the interrupt you want to set bit 28, not write 28 as bit value to the register. Now it works as expected.


14

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 ...


31

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 ...


0

I had the same problem, I solved it by changing some settings. First take a look at your configuration in the ST_CUBE_MX in the clock configuration in the value of SYSCLK. And then this same value you must write in the debugger settings, like this: I run this under Debian 10.


1

A USB-to-Serial adapter isn't a debugger. So, this won't work. Get a debugging adapter: STlink v2-compatible adapters are really cheap.


1

You need to rewrite all of those functions as STM32F4 and STM32F1 have completely different clocks, different GPIOs . Changing GPIO pin is definitely not enough.+-


1

Is this a proper method to do PWM to analog voltage conversion? Yes. Is there any way to improve the output accuracy of the STM32 and the detection accuracy of the ATtiny85 in this circuit design? Use the highest available PWM frequency. Make the r/c time constant large enough that voltage ripple is less than the accuracy you need, but small enough ...


0

It is not the same even if the name is similar. Consider why SSDxx has 80+ pins. This controller adds framebuffer and requires another controller in the TFT display (which will control the pixels). Some controllers have both in one chip like ILI9341 which has 1278 pins instead :) STM32 TFT_LCD controller just unloads the work from the core when sending RGB ...


0

Assuming ADC_Sample can only report values from 0-4095, then this formula: V = ADC_sample / 4095 * 3.3 ...is correct. Why? If you want to actually see 3.3V, you need to be able to achieve the second term: V = ADC_Sample:4095 / 4095 * 3.3 = V = 4095 / 4095 * 3.3 = V = 1 * 3.3 = V = 3.3 If you used 4096 as the second term, you would never get 3.3... V = ...


3

Consider a successive approximation ADC. Each step size successively halves the step size at the previous step, so teh first step (for the MSB) compares the input with Vref/2. Then successive steps are smaller powers of 2, until ... 4095? No, 4096. Now the ADC can output 4096 codes, from 0 to ... 4095. Every output code is effectively "rounded down" to ...


2

I believe it's all embedded in this graph from the device data sheet: - So, calculate what 1 LSb means in terms of input voltage and multiply that by the digital value produced by that input voltage. You have to take into account several error factors though such as: - Offset error (the input voltage equivalent to digital zero) Gain error (the real average ...


2

Unfortunately STM32F103 series do not have OTG_FS hardware. Reference manual is misleading as it mentions both OTG_FS and USB Device modules. This is because some parts in this family have it (like STM32F105). You can use STM32CubeMX to find a microcontroller by filtering them according to selected criteria. A framework based on ArduinoIDE is probably not ...


1

After lots of tries, I found out that, remapped SPI1 does not work together with I2C1, because of I2C1-SMBA pin overlap with SP1 MOSI pin (PB5), even if you are not using SMBA. You can find about that here: STM32F103x8 errata chapter 2.8.7 So, I guess, I will use I2C2 for avoiding collision. The only change I should make on PCB would be redirecting I2C1 ...


0

I solved it. The problem is with the user application. I build the application at correct address but the SCB->VTOR register is overwritten to offset zero from the call of SystemInit() in the application code. So I changed the VECT_OFFSET value in system_stm32f4xx.c file and everything works fine. Anyway, thank you for all the suggested answers.


3

You need a pull down resistor in you switch GPIO pin. Connect a 10K resistor from the pin to ground. The GPIO is probably floating causing the input to switch on/off very quickly when the button is not pressed. This will cause your LED to glow slightly or give random behavior. simulate this circuit – Schematic created using CircuitLab


0

I found this video about interrupt control in STM32. Hope this will helpful for someone who need more clarification apart from above answers. https://youtu.be/uFBNf7F3l60


0

Set in the Pinout & Configuration, RCC, High Speed Clock (HSE) to Crystal/Ceramic Resonator (and make sure you have it in your schematic/dev board). Than I get the following screen after setting I2C & USB and let it compute automatically the timing table:


0

No, because it is not released as source code but as precompiled binary library object. Fortunately ST has a similar touch sensing library you might want to use instead on an STM32.


0

DMA requests from each peripheral are hardwired to either DMA1 or DMA2, see the request mapping tables in the DMA functional description of the reference manual. So a request from TIM1 or TIM8 can trigger a copy operation only in DMA2, other timers can only trigger DMA1. While DMA2 transfers can reach any peripheral, the peripheral addresses on DMA1 are ...


0

If you do not want to use CPU - which is not possible if you do not use external averaging hardware. Simple lowpass filter will do or another duty


0

SWD is for programming the firmware into the STM32F031 microcontroller embedded inside the STSPIN32F0A, as well as debugging the running code through an ST-LINK programmer/debugger. As @Alex Fedoseev mentions, the UART can be used as a serial port (again through an ST-LINK if it's embedded in the demo board, which seems to be the case) for bidirectional ...


1

The F4/F7 have plenty of memory to handle this. You'll need just over 200 bytes (100 samples * 2 bytes each), which is a fraction of even the smallest F4 chips. A moving average is a type of FIR filter and has some advantages to an IIR filter (such as an "infinite average"), such as that it responds more quickly to changes and will settle more quickly on a ...


1

If it were only a small number of averages then I would create a shift register. Pseudo code for a small number of averages. function movingAverage(pulseAverage) { static register[2]; // 3 registers register[2] = register[1]; // data shift register[1] = register[0]; // data shift register[0] = pulseAverage; // move the input into the ...


1

Both functions appear to work essentially identically, except for how bits 31:24 are handled - but I do not think this is your issue. You did not specify which Arduino you were using though, and since shiftIn is a simple bit-banging function it will run att different speeds depending on what processor and speed you are working with, so if you are using an ...


1

If you want a different approach and don't want to overwrite functions or declare your own, you can simply use snprintf to archieve the same goal. But it's not as elegant. char buf[100]; snprintf(buf, 100, "%X %X", val1, val2); HAL_UART_Transmit(&huart1, (uint8_t*)buf, strlen(buf), 1000);


1

For those struggling, add the following to syscalls.c: extern UART_HandleTypeDef huart1; // access huart1 instance //extern int __io_putchar(int ch) __attribute__((weak)); // comment this out __attribute__((weak)) int __io_putchar(int ch) { HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF); return (status == ...


0

It may be theoretically possible if you were to design an interface chip which does SDIO to QSPI. Access times will be awful though. So find something else. Eg: Copy all the data from the SD card to a large QSPI flash first.


12

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


-1

Can I use an SD card instead of usual flash chip in this case? Maybe. It depends on what type of data you are dealing with. You most likely won't be able to display video, but displaying images should be possible. Can it be connected to QSPI controller like SPI flash memory? No. Although SD cards do support SPI as a fallback interface, it will be ...


2

Can I use SD card instead of usual flash chip in this case? No. SD cards are not well suited to memory-mapping in general, as they do not have predictable access times and cannot be read/written on a more granular basis than a sector (512 bytes). It will be connected to qspi controller like single spi flash memory. That won't work. The QSPI controller ...


0

First of all it is not an JTAG probe. It is the ARM SWD debugger probe. Probably you can use it with non STM32 ARM microcontrollers using openOCD. . This probe does not have UART <> USB converter you of course can't use it. You need ST-LINK V2/1


1

Do not wire two or more outputs together. That is a standard rule for push-pull type digital outputs. When other drives low while other drives high, abnormally large current flows from pin to pin and may damage one or both output pins. Also, UART needs TX output connected to RX input for communications.


1

The W5500 is an ethernet and TCP/IP controller. OSI Model layer 4. Short story, the W5500 is not a web server, and will never be. To get a web server, you have to run one on the STM32F4. The advantage is that you don't have to worry about layer 4 and below. You use the SDIO peripheral. This requires a driver. If you want the contents of the SD cards to be ...


2

Flash sector 11 might not available on the E type, only on the G type. As it is the last sector. Sectors are truncated from the higher addresses when selecting lower size parts. See chapter "Part numbering" in the datasheet. Any tips? Remove the flash lock/unlock between the erase and write. Some of the older ST parts require this to be one session. ...


3

Some reasons: printf uses _write and _read. You can write your own ones for example if you want to redirect output to SWO malloc & friends use _sbrk. Bur I would rather avoid dynamic allocation in the limited resources implementations. This version of _sbrk is very poor (it assumes that the stack is at the largest addresses and heap is just before etc ...


0

To program the flash you need to erase the page you are going to program. Some STM devices allow to program memory cells which were erased before, without the need of the page erase. But you can only change the bit values to zero. Some devices require page erase every time you are going the program it (CRC checked FLASH) Show the source code of your write ...


1

CMSIS-RTOS is a standarized RTOS abstraction from ARM. You can us it for example with FreeRTOS or Keil RTX. A oversimplified analogy may be POSIX - you can basically compile the same code on Linux, BSD and MacOS. A good use case can be migration. If you eventually want to migrate (on ARM CPUs) from FreeRTOS to a different RTOS, then use the CMSIS API. If ...


2

This is almost 100% opinion based answer. I personally do not like CMSIS wrappers. There is to much silly (IMO) macros and hidden objects created by them. I actually prefere freeRTOS API if I use freeRTOS. It makes also debugging more difficult.


1

It works just as expected from that code that controls the uarts - first there is transmission out on UART3, and after that is fully complete there is reception from UART2. So UART2 does not see any reception as at that time there is no transmission going on UART3.


-1

You need the voltage converter which will convert 3.3V VDD to 5V required by the USB. Vbus uC pin does not power anything!!!! It is used in the device mode to sense the presence of the USB power.


1

It is far not enough. You need to disable all interrupts in the NVIC.


1

do STM assume that working with registers is not necessary when I use STM32? Yes. They don't want you to bang the registers directly, because then they would have to document them properly and you would have to know about any differences between devices (including hardware bugs). By going through the Hardware Abstraction Layer you are shielded from all ...


0

It depends on the MCU and the timer clock frequency (APB in most cases). Standard timers have 16 bit counters and 16 bit prescalers. They can measure up to 232 cycles, but the resolution would be 16 bits only. About 51 seconds at 84 MHz APB clock. Some timers have 32 bit counters and 16 bit prescalers. They can measure up to 232 cycles without using the ...


Top 50 recent answers are included