/r/stm32f4

Photograph via snooOG

The STM32 series are great CPUs for embedded developers, hackers, musicians and the like to work with. This a place to share information, get people started with it, show off your work, answer hard questions, etc. related to the STM32 CPUs. This includes all Cortex CPUs, too, such as MSP432 and even Microchip Cortex chips.

/r/stm32f4

6,354 Subscribers

1

STM32F411CEU6 system clock not switching to PLL

I am trying to achieve high clock speeds on my STM32F411CEU6 board (96 MHZ) by tweaking the PLL clock without HAL. I have set the PLL clock source to HSE (25 MHz). My code halts whenever my debugger reaches this line:

setBits(RCC->CFGR, RCC_CFGR_SW, RCC_CFGR_SW_PLL);
halt((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_PLL);

I can not figure out why. I have set the flash latency to the absolute maximum hoping it would help, since it did not work when I set it to 3WS (>90 MHz, 3.3V).

Implementation:

  • Macros:
inline void spin (volatile u32 pCount)
{
    while (pCount--) asm("nop");
}
#define halt(cond) while (cond) { spin(1); }

#define setBits(x, msk, v) x = ((x) & ~((u32)(msk))) | (u32)(v)
#define clearBits(x, msk) x = ((x) & ~(u32)(msk))
  • Init function:
void fhInit()
{
    fhInitPower();
    fhMspInit();
    fhHseInit();
    fhPllInit();
    fhCpuClockInit();

    systickInit();
}
  • Functions:
void fhMspInit()
{
    setBits(FLASH->ACR, FLASH_ACR_ICEN | FLASH_ACR_DCEN | FLASH_ACR_PRFTEN | FLASH_ACR_LATENCY, FLASH_ACR_ICEN | FLASH_ACR_DCEN | FLASH_ACR_PRFTEN | FLASH_ACR_LATENCY_7WS);
}

void fhHseInit()
{
    setBits(RCC->CR, RCC_CR_HSEON, RCC_CR_HSEON);
    halt(RCC->CR & RCC_CR_HSERDY == 0);
}

void fhPllDisable()
{
    setBits(RCC->CR, RCC_CR_PLLON, 0);
    halt(RCC->CR & RCC_CR_PLLRDY);
}

void fhPllEnable()
{
    setBits(RCC->CR, RCC_CR_PLLON, 1);
    halt(RCC->CR & RCC_CR_PLLRDY == 0);
}

void fhPllInit()
{
    fhPllDisable();

    auto m = 25;
    auto n = 192;
    auto p = 2;
    auto q = 4;

    auto pllReg = RCC_PLLCFGR_PLLSRC_HSE;
    pllReg |= m << RCC_PLLCFGR_PLLM_Pos;
    pllReg |= n << RCC_PLLCFGR_PLLN_Pos;
    pllReg |= (p >> 1) - 1 << RCC_PLLCFGR_PLLP_Pos;
    pllReg |= q <<  RCC_PLLCFGR_PLLQ_Pos;

    setBits(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLP | RCC_PLLCFGR_PLLQ, pllReg);

    fhPllEnable();
}

void fhInitPower()
{
    RCC->APB1ENR |= RCC_APB1ENR_PWREN;
    setBits(PWR->CR, PWR_CR_VOS, 0b11 << PWR_CR_VOS_Pos);
}

void fhUpdateCoreClock()
{
    u32 pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;
    u32 pllvco = (uint64_t)HSE_VALUE * (uint64_t)((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos) / (uint64_t)pllm;
    u32 pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >> RCC_PLLCFGR_PLLP_Pos) + 1U) * 2U;
    u32 sysCfkFreq = pllvco / pllp;
    SystemCoreClock = sysCfkFreq >> AHBPrescTable[(RCC->CFGR & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos];
}

void fhCpuClockInit()
{
    fhPllEnable();

    setBits(RCC->CFGR, RCC_CFGR_PPRE1 | RCC_CFGR_PPRE2 | RCC_CFGR_HPRE, RCC_CFGR_PPRE2_DIV1 | RCC_CFGR_PPRE1_DIV2 | RCC_CFGR_HPRE_DIV1);

    setBits(RCC->CFGR, RCC_CFGR_SW, RCC_CFGR_SW_PLL);
    halt((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_PLL);

    fhUpdateCoreClock();
}

This clock configuration works perfectly in the Cube IDE when using HAL, so it is not a hardware problem.

Clock diagram

Here is the github repo containing the whole project

0 Comments
2024/12/02
23:01 UTC

0

Getting Started with TouchGFX for STM32 :TouchGFX STM32CubeIDE 1

0 Comments
2024/11/29
10:25 UTC

1

Touchscreen Display for STM32F407VET6

Hi, I'm currently working on a project using the "Black" STM32F407VET6 board, and on the lookout for a good 7" touchscreen display choice.

I plan to use LVGL with ZephyrOS to draw some complex UI (mostly buttons, lots of pages though), and I need help figuring out what I should be looking for.

I ran into this thread that raises the concern of not enough memory being available on the microcontroller for frame buffers, and mentions using a display with a controller that has onboard RAM.

How would I make that kind of thing work with LVGL, or any other graphics library?

Would appreciate links to code or articles if you have worked on similar projects. Thanks!

1 Comment
2024/11/27
12:42 UTC

0

STM32 Based Chat App (STM32H7 - Ethernet - LWIP - Keyboard(HID) - Nextion Screen )

0 Comments
2024/11/24
23:45 UTC

0

How to Debugg Code into STM32 MCU using LabVIEW?

1 Comment
2024/11/20
14:39 UTC

1

Voice Recorder Into SD Card (STM32 - I2S - DMA - QT - UART)

0 Comments
2024/11/17
18:16 UTC

5

Introduction to STM32F412 Discovery Kit Getting Started /circuitpython

0 Comments
2024/11/16
15:41 UTC

1

STM32F4 - ADC - Multiple Channels using DMA - Register Level

0 Comments
2024/11/06
20:39 UTC

1

STM32 - Controlling Servo From PC - UART - PWM - Register Level

0 Comments
2024/11/06
20:39 UTC

1

Help needed with configuring USART1 on STM32F411CEU6

Hi everyone! I’m working with an STM32F411CEU6 and trying to set up USART1. Clock settings: HSE 25MHz is selected, and PLL is configured to get 96MHx Sysclk, APB2 running at 48 MHz.
I’ve tried setting it to both the calculated baud rate values for 115200. PA9 (TX) and PA10 (RX) are set to alternate function, with high speed and pull-up mode.

void systemClockCfg(void){
PWR -> CR |= PWR_CR_VOS_0 | PWR_CR_VOS_1;

RCC -> CR |= RCC_CR_HSEON; //External High speed 25MHz
while((RCC -> CR & RCC_CR_HSERDY) == 0){}

RCC -> PLLCFGR |= (25 << RCC_PLLCFGR_PLLM_Pos) | // 1MHz
(192 << RCC_PLLCFGR_PLLN_Pos) | //192MHz
(0 << RCC_PLLCFGR_PLLP_Pos) | // 96 MHz
(RCC_PLLCFGR_PLLSRC_HSE) | // PLL enable
(4 << RCC_PLLCFGR_PLLQ_Pos);

RCC -> CR |= RCC_CR_PLLON;
while((RCC -> CR & RCC_CR_PLLRDY) == 0){}

RCC -> CFGR = RCC_CFGR_HPRE_DIV1 | // AHB 96 MHz
RCC_CFGR_PPRE1_DIV4 | //APB1 24MHz
RCC_CFGR_PPRE2_DIV2; //APB2 48 MHz

FLASH->ACR = FLASH_ACR_LATENCY_3WS;

RCC -> CFGR |= RCC_CFGR_SW_PLL;
while((RCC -> CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_PLL){}
}

void systemPerephCfg(void){
// Timer for delay initiation
RCC -> APB1ENR |= RCC_APB1ENR_TIM2EN | RCC_APB1ENR_PWREN;
RCC -> AHB1ENR |= RCC_AHB1ENR_GPIOAEN;

//USART1 enable
RCC -> APB2ENR |= RCC_APB2ENR_USART1EN;
GPIOA -> MODER &= ~(GPIO_MODER_MODE9) | ~(GPIO_MODER_MODE10);
GPIOA -> MODER |= GPIO_MODER_MODE9_1 | GPIO_MODER_MODE10_1;
GPIOA -> OTYPER &= ~(GPIO_OTYPER_OT9) | ~(GPIO_OTYPER_OT10);
GPIOA -> OSPEEDR &= ~(GPIO_OSPEEDR_OSPEED9) | ~(GPIO_OSPEEDR_OSPEED10);
GPIOA -> OSPEEDR &= GPIO_OSPEEDR_OSPEED9 | GPIO_OSPEEDR_OSPEED10;
GPIOA -> PUPDR &= ~(GPIO_PUPDR_PUPD9) | ~(GPIO_PUPDR_PUPD10);
GPIOA -> PUPDR &= GPIO_PUPDR_PUPD9_0 | GPIO_PUPDR_PUPD10_0;
GPIOA -> AFR[1] &= ~(GPIO_AFRH_AFSEL9) | ~(GPIO_AFRH_AFSEL10);
GPIOA -> AFR[1] |= (7 << GPIO_AFRH_AFSEL9_Pos) | (7 << GPIO_AFRH_AFSEL10_Pos);
}
void uartInit(void){
USART1 -> BRR = (26 << USART_BRR_DIV_Mantissa_Pos) | (1 << USART_BRR_DIV_Fraction_Pos);
USART1 -> CR1 |= USART_CR1_UE | USART_CR1_TE | USART_CR1_RE;
USART1 -> CR1 &= ~USART_CR1_OVER8 | ~USART_CR1_M;
}

void systemInit(void)
{
    /* FPU settings ------------------------------------------------------------*/
    #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
        SCB->CPACR |= ((3UL << 10*2) | (3UL << 11*2));  /* set CP10 and CP11 Full Access */
    #endif

    systemClockCfg();
    systemPerephCfg();
    uartInit();
}
int main(void)
{
__enable_irq();
    systemInit();
while(1){
while(!(USART1 -> SR & USART_SR_TXE));
USART1 -> DR = 0x50;
while (!(USART1->SR & USART_SR_TC));
}
}
1 Comment
2024/11/05
20:29 UTC

2

CONTROLLING DYNAMIXEL RX28 SERVO ANGLE AND SPEED WITH STM32 FROM PYTHON INPUT

Previously i made a code for running two dynamixel rx28 servos with an stm32f401ccu6 blackpill. The code uses dynamixel's protocol 1.0 to convert the digital pinout of rx28 to UART. The stm32f401ccu6 was configured to run UART (rx, tx) and led on pin C13. i made the code be able to control set_position with degree and set_speed with rpm. and the other variables i put to read only are goal position, moving speed, present position, present speed, present load, present temperature, present voltage, and is moving.

From that code, i plan to control the servo by sending data from python to stm32. i wanna be able to set the degrees and rpm in a python environment.

I'd also want to receive the readable variable data mentioned before in the first code, in the python environment

0 Comments
2024/11/05
15:27 UTC

1

CONTROLLING DYNAMIXEL RX28 SERVO ANGLE AND SPEED WITH STM32 FROM PYTHON INPUT

Previously i made a code for running two dynamixel rx28 servos with an stm32f401ccu6 blackpill. The code uses dynamixel's protocol 1.0 to convert the digital pinout of rx28 to UART. The stm32f401ccu6 was configured to run UART (rx, tx) and led on pin C13. i made the code be able to control set_position with degree and set_speed with rpm. and the other variables i put to read only are goal position, moving speed, present position, present speed, present load, present temperature, present voltage, and is moving.

From that code, i plan to control the servo by sending data from python to stm32. i wanna be able to set the degrees and rpm in a python environment.

I'd also want to receive the readable variable data mentioned before in the first code, in the python environment

1 Comment
2024/11/05
15:27 UTC

1

SERIAL COMMUNICATION STM32 FROM PYTHON TO STM32

How do i send data from python to stm32 with pyserial from com3 port. Here i have a project that controls a dynamixel servo rx28's angle of which i take the angle input from python terminal. How do i do it? I am stuck pls help

0 Comments
2024/11/05
14:23 UTC

1

Trying to convert time and date from UTC to IST...In STM32

Time and date I am getting it from GPS module to my stm32 and I wanna convert it from UTC to IST. Time I have converted easily by adding time difference, depending on the time I wanna convert the date... I am struggling in date conversion can you please help me in the logic Or suggest me timezone conversion Library in C for me to use...

1 Comment
2024/10/17
11:54 UTC

3

Crazy STM32 Mystery - please HELP - pretty please with sugar on top!

4 Comments
2024/10/16
07:37 UTC

5

Do I need license to compile for USB/ Ethernet features?

I have bought the NUCLEO-F429ZI and I want to use its USB and ethernet features.

I downloaded armKEIL so I can open uVision and compile, upload code etc.

https://preview.redd.it/4jk0njmqmptd1.png?width=1768&format=png&auto=webp&s=5f6e6a72c528e9f369212bbfa5f4ff4257a3aeb6

I manage to compile code and make my own libraries for UART, I2C, SPI and now I try to use USB.
When I try to compile a already-existing USB example (HID) from uVision, I get error: "The component 'Keil::USB&MDK-Plus:Device:HID' requires a valid 'Keil MDK Professional' UBL license."

I am using the free version of license.

  1. So I can not create USB (or ethernet) projects with free version of the license?
  2. Do with other MCUs in the market need purchasing licences as well to use their Ethernet or USB features?
1 Comment
2024/10/09
10:47 UTC

6

STM32F412 Discovery kit

https://www.youtube.com/shorts/vmvPLwYT76w

https://www.youtube.com/shorts/eWtFkBsItys

https://www.youtube.com/shorts/HFJmNZtaJxQ

STM32F412 Discovery kit
"Innovation from Old Boards": Since I have old boards that have been stored away for a long time and are no longer in use, I decided to revive and repurpose them to create something useful and valuable. By transforming these old materials, I aim to develop a new and interesting project. We can apply our creativity and skills to turn the old boards into something beneficial for our daily lives or work.

https://preview.redd.it/i0jae2atkwsd1.jpg?width=1079&format=pjpg&auto=webp&s=556710f2912aa7e1cbf627114af415b97540cd11

https://preview.redd.it/tzskkqstjwsd1.jpg?width=1152&format=pjpg&auto=webp&s=8b8ffb4b30df18716d2c22d73e145329afd45ffd

0 Comments
2024/10/05
09:02 UTC

1

STM32 not working with ST-LINK V2?

Hello everyone
It's my first time messing around with STM32 microcontrollers
A few days back I got a black pill (STM32F401CCU6) and an ST-Link V2. The black pill came with 3 buttons, namely (KEY, NRST, BOOT0) and a USB-C Port. Since the ST-Link was arriving later, I connected the black pill to my PC through USB-C. The LED on the black pill turned on, I fired up the Arduino IDE, wrote a tiny blink program, and it worked.
A few days later, I got the ST-Link V2. I connected the SWCLK, SWDIO, GND and 3.3V terminals to the black pill as I found online, and connected the ST-Link to my computer. The LED inside the ST-Link turns on, but the LED on the black pill doesn't turn on. The ST-Link is detected by the STM32CubeIDE, I also did a firmware upgrade as the software suggested, but it still couldn't detect the black pill.
The black pill still works fine through USB-C.

Is this a connection issue between the ST-Link and the black pill? Or do I have to use the buttons to reconfigure/ reset the black pill to make it work with the ST-Link?

2 Comments
2024/09/29
20:57 UTC

2

Triple regular simultaneous model only stm32f4

I've trying to config Triple mode in Adc and when i use DMA mode 1 for transfer the CDR register is getting data from ADC3 only but works when DMA Mode 2

this is the code:

/*
* adc.c
*
* Created on: Sep 21, 2024
* Author: Vishnu
*/

#include <adc.h>

volatile uint32_t adc_data;
volatile uint16_t dma2_status;
uint16_t adc1_data; // Extract ADC1 data
uint16_t adc2_data;
uint16_t adc3_data;

void adc_init(void){

//Enable Clock
RCC -> AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
RCC -> AHB1ENR |= RCC_AHB1ENR_DMA2EN;
RCC -> APB1ENR |= RCC_APB1ENR_TIM2EN;
RCC -> APB2ENR |= RCC_APB2ENR_ADC1EN;
RCC -> APB2ENR |= RCC_APB2ENR_ADC2EN;
RCC -> APB2ENR |= RCC_APB2ENR_ADC3EN;

//Set PA1, PA2, PA3, as Analog port
GPIOA -> MODER |= (GPIO_MODER_MODER1_0) | (GPIO_MODER_MODER1_1);
GPIOA -> MODER |= (GPIO_MODER_MODER2_0) | (GPIO_MODER_MODER2_1);
GPIOA -> MODER |= (GPIO_MODER_MODER3_0) | (GPIO_MODER_MODER3_1);

// Configure ADC

//ADC1
ADC1 -> SQR3 |= (0X01); // Select Ch 1
ADC1 -> CR2 |= (ADC_CR2_EXTEN_0); // Enable External trigger
ADC1 -> CR2 &= ~(ADC_CR2_EXTEN_1);
ADC1 -> CR2 &= ~( (ADC_CR2_EXTSEL_0) | (ADC_CR2_EXTSEL_3)); // Select TIM2 TRGO event
ADC1 -> CR2 |= (ADC_CR2_EXTSEL_1) | (ADC_CR2_EXTSEL_2);

// ADC1 -> CR2 |= (ADC_CR2_DMA) | (ADC_CR2_DDS); //Enable DMA
ADC1 -> CR2 |= (ADC_CR2_ADON); //Enable ADC1

//ADC2
ADC2 -> SQR3 |= (0X02); // Select Ch 2
ADC2 -> CR2 |= (ADC_CR2_ADON); //Enable ADC1

//ADC3
ADC3 -> SQR3 |= (0X03); // Select Ch 3
ADC3 -> CR2 |= (ADC_CR2_ADON); //Enable ADC1

 

// Config DMA2
DMA2_Stream0 -> CR &= ~(DMA_SxCR_EN); //Disable DMA
while(( (DMA2_Stream0 -> CR) & (DMA_SxCR_EN) )){} // Wait till stream is disable
//Select Ch0
DMA2_Stream0 -> CR &= ~( (DMA_SxCR_CHSEL_0) | (DMA_SxCR_CHSEL_1) | (DMA_SxCR_CHSEL_2) );

DMA2_Stream0 -> CR |= (DMA_SxCR_PL_0) | (DMA_SxCR_PL_1); // Set very high Priority level

DMA2_Stream0 -> CR &= ~(DMA_SxCR_MSIZE_0); //Set MSize 32-bit
DMA2_Stream0 -> CR |= (DMA_SxCR_MSIZE_1);

DMA2_Stream0 -> CR &= ~(DMA_SxCR_PSIZE_0); //Set PSize 32-bit
DMA2_Stream0 -> CR |= (DMA_SxCR_PSIZE_1);

DMA2_Stream0 -> CR |= (DMA_SxCR_MINC); //Enable Mem Inc
DMA2_Stream0 -> CR |= (DMA_SxCR_PINC); //Enable Mem Inc
DMA2_Stream0 -> CR |= (DMA_SxCR_CIRC); //Enable circular mode
DMA2_Stream0 -> CR &= ~( (DMA_SxCR_DIR_0) | (DMA_SxCR_DIR_1)); //Set transfer direction

DMA2_Stream0 -> NDTR |= 1; //Set no.of data register
DMA2_Stream0 -> PAR = (uint32_t) (&(ADC -> CDR)); //Set Peri Address
DMA2_Stream0 -> M0AR = (uint32_t) (&adc_data); //Set Mem Address

// Enable DMA transfer complete interrupt
DMA2_Stream0 -> CR |= DMA_SxCR_TCIE; // Enable transfer complete interrupt

// Enable DMA interrupt in NVIC
NVIC_EnableIRQ(DMA2_Stream0_IRQn);

/* CONFIG TIMER FOR TRIGGER */
TIM2 -> PSC = (8400 - 1); // Set prescaler for 10000Hz timer frequency
TIM2 -> ARR = (10000-1); // Set auto reload value

TIM2 -> CR2 &= ~(( 1U << 4) | ( 1U << 6)); // Select update event for TRGO
TIM2 -> CR2 |= ( 1U << 5);

ADC -> CCR |= (ADC_CCR_DDS);
ADC -> CCR |= (ADC_CCR_DMA_1); //Set DMA Mode 1
ADC -> CCR |= (0x016); // Enable Dual Mode

}

void adc_start(void){

DMA2_Stream0 -> CR |= (DMA_SxCR_EN); // Enable DMA
TIM2 -> CR1 |= ( TIM_CR1_CEN); // Enable TIM2

}

// Interrupt Service Routine for DMA2 Stream 0
void DMA2_Stream0_IRQHandler(void) {
// Check for DMA transfer complete interrupt flag
if(DMA2->LISR & DMA_LISR_TCIF0) {
// Clear the interrupt flag
DMA2->LIFCR |= DMA_LIFCR_CTCIF0;
// Set flag to indicate that the transfer is complete
dma2_status = 1;

}
}

0 Comments
2024/09/23
15:45 UTC

1

Thonny won't run Micropython on NUCLEO-F401RE (Mac)

I am trying to use a NUCLEO-F401RE with Thonny and micropython in mac (Sonoma 14.6.1). However, Thonny cannot connect to the NUCLEO-F401RE, and it throws the following error:

Device is busy or does not respond. Your options:

  - wait until it completes current work;
  - use Ctrl+C to interrupt current work;
  - reset the device and try again;
  - check connection properties;
  - make sure the device has suitable MicroPython / CircuitPython / firmware;
  - make sure the device is not in bootloader mode.

Also, it won't appear in the files window.

However, I checked the port configuration in Thoony and the device file appears as an option. Also, the NUCLEO-F401RE appears in the Mac system report under the USB Device tree.

The firmware I installed in the NUCLEO-F401RE is called NUCLEO_F401RE.bin and downloaded it from this GitHub repository:https://github.com/curtywang/stm32_micropython_mbed_bins/releases/tag/v1.19

Since my mac only has USB-C, I've tried using different USB adaptors (both original and third party ones) but non of them work.

PD: I need to do this for a class, and a classmate (who also has a Mac) has the same problem.

I am trying to use a NUCLEO-F401RE with Thonny and micropython in mac (Sonoma 14.6.1). However, Thonny cannot connect to the NUCLEO-F401RE, and it throws the following error:

Device is busy or does not respond. Your options:

  - wait until it completes current work;
  - use Ctrl+C to interrupt current work;
  - reset the device and try again;
  - check connection properties;
  - make sure the device has suitable MicroPython / CircuitPython / firmware;
  - make sure the device is not in bootloader mode.

Also, it won't appear in the files window.

However, I checked the port configuration in Thoony and the device file appears as an option. Also, the NUCLEO-F401RE appears in the Mac system report under the USB Device tree.

The firmware I installed in the NUCLEO-F401RE is called NUCLEO_F401RE.bin and downloaded it from this GitHub repository:https://github.com/curtywang/stm32_micropython_mbed_bins/releases/tag/v1.19

Since my mac only has USB-C, I've tried using different USB adaptors (both original and third party ones) but non of them work.

PD: I need to do this for a class, and a classmate (who also has a Mac) has the same problem.

1 Comment
2024/09/23
01:12 UTC

1

Undefined Reference to _estack and _sdata When Building STM32 Project with Simulink and CubeMX

I'm trying to build a project using Simulink to generate code for my STM32F411RE board. I'm using STM32CubeMX to configure the peripherals and importing the generated .ioc file into Simulink. Everything seems to be set up correctly, but when I try to build the model, I encounter the following errors during the linking phase:

undefined reference to `_estack`
undefined reference to `_sdata`
undefined reference to `_sidata`
undefined reference to `_sbss`
undefined reference to `_ebss`

These errors seem related to the startup file or memory sections, and I'm not sure whether the issue is with CubeMX's generated configuration or something in the Simulink setup.

Here’s what I’ve done so far:

  • I created the project in STM32CubeMX for my board and configured peripherals like timers.
  • Imported the .ioc file into Simulink to generate code.
  • Tried building the code, which results in the linker error related to undefined memory references.

Has anyone encountered this issue before? Any suggestions on how to fix this?

Thanks for any help!

3 Comments
2024/09/22
21:50 UTC

1

TRIPLE MODE ADC IN STM32F407. Need help

0 Comments
2024/09/22
20:54 UTC

1

No Response from PZEM-004T Module using USART Communication

I'm currently facing an issue with my custom USART driver for communicating with the PZEM-004T module. I've successfully developed and tested this driver, and it works perfectly with other devices like the ESP32, where I receive responses without any problems. However, when I attempt to communicate with the PZEM-004T, the data sent appears correctly on the logic analyzer, but I receive no response from the slave, i also tried sending the command from pc using Tera Term 5 but same. I've verified that I’m using the correct settings: a baud rate of 9600, 8 data bits, 1 stop bit, and no parity. Additionally, I've checked the Special Function Registers (SFRs) to ensure everything is set up correctly. I've also tried changing the slave address and modifying the Modbus command, but none of these adjustments have yielded any results. Any guidance or suggestions on how to troubleshoot this issue would be greatly appreciated.

I don’t believe the problem from my code as i said i already tested it with other SLAVES. I think the sensor isn’t receiving the right command or something, but I've checked with others who used the same command and received a reply.

I’m really struggling with this problem, and I would greatly appreciate any help anyone can offer.

https://preview.redd.it/z4dfy47s97qd1.png?width=1918&format=png&auto=webp&s=4eb6ba75f70d79932da5b2b80f032870e6f1bb88

https://reddit.com/link/1fm8sen/video/1vgldtrra7qd1/player

0 Comments
2024/09/21
17:54 UTC

1

ST32F44 and ADS1299 no data on MISO

Hi so this is the setup: PC6=ADC_CLKSEL; PD11=ADC_PDWN; PD13=ADC_DRDY; PD15=ADC_CS; PB13=SPI_SCK;PB14=SPI_MISO; PB15=SPI_MOSI and PC7 =ADS_RESET.

Initialization

Initialization

when I hit the while loop I'm doing the request for the device ID

https://preview.redd.it/5jtrr7pqsnpd1.png?width=566&format=png&auto=webp&s=56ed81ac8570b55029c1c57e019149d5ae6d4cb8

result on the logical analyzer

https://preview.redd.it/o8o0zetfunpd1.jpg?width=897&format=pjpg&auto=webp&s=d9791cad57655a3f2d66f9b592b9c41f9d16ed9d

I see the request goin but nothing comes back on the MISO.

For CUBE MX

https://preview.redd.it/5ljx96citnpd1.jpg?width=1119&format=pjpg&auto=webp&s=9b4e5ee407532fc29078fefc524919705447b82e

Question , what I'm doing wrong ? Only thing that comes in my mind is I'm doing something wrong during the Initialization steps ?

3 Comments
2024/09/19
00:23 UTC

1

Absolutely Baffling STM32 Mystery - please help!

0 Comments
2024/09/16
03:12 UTC

1

I need help with interfacing my barcode scanner as a device with the stm32f401 as a USB host

I had a ton of experiments trying to get it working but nothing happened and no progress at all. Even YouTube tutorials that work with them like rockets don't even say blah with me.

Currently,

  • I have stm32f401 (blackpill) powered by the st-link USB from the laptop.
  • A power supply with 5V output is needed to supply the scanner with the 5V / 85mA it needs.
  • I have the scanner's male USB plugged into a female USB with a 4-wire extension for each pin.

the 4-wires are connected like this:
GND wire: power supply GND
VCC wire: power supply VCC
D+ : to stm32 D+
D- : to stm32 D-

stm32, the scanner's USB and the power supply have common ground.

Are there any further considerations HW or SW that I need to consider?

0 Comments
2024/09/14
16:00 UTC

0

Tìm cảm biến độ ẩm đất

Mọi người cho em hỏi có cảm biến độ ẩm đất nào phù hợp để đo độ ẩm đất cho vườn cây sầu riêng, trả tính hiệu về vi đều khiển không ạ

0 Comments
2024/09/13
02:36 UTC

1

I need help in integrating the functions from shared .c files to my main.c file. I want to implement PID controller in c language using STM32 MCU.

Hello and Thanks for coming to read my question.

I am very beginer to the c coding, i didn't have any coding experience so i am facing a lot of difficulties in generating the code for PID controller.

I found pid_controller.c and pid_controller.h libaries for online for PID controller which can be used with microcontroller.

I have STM32F407, and with the help of cube IDE software I have created the template main.c file

based on pid_contro.c and h files I am wiriting the code but unable to write correct code and everytime getting error, actually I don't know which functions and variables I could include from pid_controller.c and pid_controller.h files into my main.c file so that the code should run in sequence and correctly.

I also don't know which function should be written inside the int main(void) and inside the while () and outside the main(void).

If someone is willing to help me I will appreciate and happy to offer him/her a coffee.

My code can be found via following link PID Controller

0 Comments
2024/09/09
14:06 UTC

Back To Top