cancel
Showing results for 
Search instead for 
Did you mean: 

Transfer from STM32f411RE to STM32F411ce

MHovi.1
Associate II

Hi there,

Recently if done a project regarding custom hid on a STM32F411RE Nucleo prototype board, this was successful. I have created my own pcb design but unfortunatly due the lack of availability of the STM32F411RE i was forced to go with the STM32F411CE QFN48. Adapted my board design and after populating my newly received boards i run into a snag. I adapted my original code to the 411CE alas its not popping up in my windows device list as a custom HID device. But it does show in DFU mode , i can upload my code through ST LINK. Debugger in CUBEIDE works fine. Just to keep it simple i made a bare project which only use the custom HID options out of CUBE IDE. Does behave exactly as described, but not showing up as Custom HID Device.

Might be a bit short sighted but i think it is not my PCB design,cause of the above behavior.

Maybe someone in here has some experience with the F411CE and can put me on the right track.

Thanks in advance.

15 REPLIES 15
MHovi.1
Associate II

Did some more testing/measuring.

SPI clock and chip select works fine. All connection seems to be as designed.

ADC is working, I can see it in live expressions in the debugger.

In ST link the device gets detected and reads the memory.

Still got the impression it's not the PCB.

Tried to upload a simple keyboard hid code.

Code gets compiled and flashed in the mcu, but doesn't show up as hid keyboard.

I'll try a simple led blink code tomorrow.

The HSE starts properly? Frequency matches HSE_VALUE? PLL's start/clock as expected? Check use MCO/PA8

The Nucleo pulls an 8 MHz source from the ST-LINK

If you pull BOOT0 High, does System Loader come up as a USB DFU / STM32 BOOT LOADER type device?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hi Tesla,

Yes it shows up as a STM32 BOOT LOADER device.

TDK
Guru

There's nothing dramatically different between these chips. Code that works on one should generally work on the other without modification. If the USB DFU bootloader works correctly, there is probably a bug in your program.

If you feel a post has answered your question, please click "Accept as Solution".
MHovi.1
Associate II

Update,

Just came to the conclusion the 4 pad crystal wasn't correctly placed, it was 180 rotated. I couldn't see where the pin 1 of the crystal was located so i just swapped it.

I made a quick Custom HID program and it worked.

After this correction my device works as designed. Thanks Tesla to pointing me to the clock.

TDK,

Unfortunately my original program didn't work on the F411CE , don´t know why jet but will tru to figure it out over the weekend.

Thanks for the help this far.

MHovi.1
Associate II

I have been trying but no luck.

Tested the project on my nucleo with f411 re ,zero issues.

Looks like I have to start from the ground up again and debug it step by step to see what's going on.

MHovi.1
Associate II

I have been Checking my HSE clock again on the RCC_MCO1 pin the output is 16.13 MHz , but USB custom HID needs 48 MHz. So something is of.

I configured the clock options through cube ide.

Been reading through datasheet of the F411 and some articles about crystals.

But to my knowledge i have done the setup right, maybe someone see an error

The code generated by cube ide below.

Hopefully someone could push me in the right direction.

void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
 
  /** Configure the main internal regulator output voltage
  */
  __HAL_RCC_PWR_CLK_ENABLE();
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
  /** Initializes the RCC Oscillators according to the specified parameters
  * in the RCC_OscInitTypeDef structure.
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL.PLLM = 4;
  RCC_OscInitStruct.PLL.PLLN = 72;
  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  RCC_OscInitStruct.PLL.PLLQ = 3;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }
  /** Initializes the CPU, AHB and APB buses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
 
  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
  {
    Error_Handler();
  }
}

and the clock config in Cube ide

0693W00000BdTgNQAV.jpg0693W00000BdTeCQAV.jpg

MHovi.1
Associate II

Banging my head on the keyboard here;)

My while loop doesn't run, so i suspect my oscillator isn't starting. My ADC does run but seems like ADC is not clock dependent.

Does the HAL layer work regarding clock settings?

If i select HSI i can measure the 16 MHz freq.

Just for future pcb design, is the LSI mandatory or can it be left out of the design.(for now it will be only a USB custom hid board).

Some help will be appreciated.

Thanks

0693W00000BdaxVQAR.png

TDK
Guru

> I have been Checking my HSE clock again on the RCC_MCO1 pin the output is 16.13 MHz

Certainly seems like it's using HSI and not HSE. Does Error_Handler get executed? Put something in there so calls do not silently fail.

What crystal are you using? 5pF seems low.

> Just for future pcb design, is the LSI mandatory or can it be left out of the design.

The LSI is internal to the chip. The LSE (low speed external crystal) is optional.

If you feel a post has answered your question, please click "Accept as Solution".