Skip to main content
Javier1
Principal
April 28, 2022
Solved

Including FATFS with CubeMX breaks everything.

  • April 28, 2022
  • 7 replies
  • 3503 views

Using an stm32f105RBt6 :

  • i have a working project with canbus and USBdevice.
  • i have another working project with canbus and FAtFS(SPI-sd card)

None of them work once i include FATfs+USBCDCdevice

i dont know what to make up from this, last time i had a similar error i had messed up my include logic.

  • 0693W00000LzMWPQA3.png0693W00000LzMTVQA3.pngstm32f105RBt6 custom board.
  • SD Card trough SPI2, sandisk ultra 16GB.
  • CubeMx version 6.4.0, STM32Cube_FW_F1_V1.8.4 package which uses FatFs version R0.10c, Nov 09, 2014.
  • CubeIDE Version: 1.8.0

This topic has been closed for replies.
Best answer by TDK

Is this post really the best answer, or is it the post pointing out that you're missing a bracket and where specifically that bracket is?

7 replies

TDK
April 28, 2022

If the compiler says MX_GPIO_Init isn't defined, it's probably not defined. Perhaps you are missing brackets. Hard to tell with the limited information you've provided. If you attach the full main.c file I'm sure the error will be spotted.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Javier1
Javier1Author
Principal
April 28, 2022

@TDK​ You were right, i checked and they are defined but for some reason the compiler throws this error.

Just to clarify, this are all generated by CubeMx i didnt touched them.

The error was not there before i tried to include FatFs (or i tried to include USBCDC in another working FatFs project)

0693W00000LzMuHQAV.png 

I also checked the "expected declaration..." error, i didnt change anything at all.... i dont think cubeMx missed a ";"0693W00000LzMwcQAF.png

hit me up in https://www.linkedin.com/in/javiermuñoz/
TDK
April 28, 2022

You are missing a closing bracket in the USER CODE 3 section to close out the while loop.

 /* Infinite loop */
 /* USER CODE BEGIN WHILE */
 while (1)
 {
 
 /* USER CODE END WHILE */
 
 /* USER CODE BEGIN 3 */
 
		 TransmittingAtruntimeUSB(&htim7);
		 CANBUSfiletransfer();
 /* USER CODE END 3 */

> Just to clarify, this are all generated by CubeMx i didnt touched them.

The content in the USER CODE sections contradicts this.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Javier1
Javier1Author
Principal
April 29, 2022

>You are missing a closing bracket in the USER CODE 3 section to close out the while loop.

Youre right!, i will review all brackets.....

> The content in the USER CODE sections contradicts this.

I didnt explain myself right:

  1. I have a working (compiling ok) code
  2. i make changes in its cubeMx (to add SDcard functionalities) and click "Generate code"
  3. Now there is brackets missing in main.c???
hit me up in https://www.linkedin.com/in/javiermuñoz/
Javier1
Javier1Author
Principal
April 29, 2022

found the issue, thanks for your help @TDK​ 

I must had copy pasted at some point since the last cubeMx generation the label Inside the while(1) loop by mistake,

/* USER CODE END 3 */

this was confusing cubeMX

0693W00000LzQc7QAF.pngI removed the extra label and everything works

hit me up in https://www.linkedin.com/in/javiermuñoz/