cancel
Showing results for 
Search instead for 
Did you mean: 

Including FATFS with CubeMX breaks everything.

Javier1
Principal

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

we dont need to firmware by ourselves, lets talk
1 ACCEPTED SOLUTION

Accepted Solutions

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?

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

View solution in original post

7 REPLIES 7
TDK
Guru

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

@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

we dont need to firmware by ourselves, lets talk
TDK
Guru

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

>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???
we dont need to firmware by ourselves, lets talk

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

we dont need to firmware by ourselves, lets talk

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?

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

Maybe i didnt explained myself correctly, i didnt missed any brakets.

As i explained in the previous comment :

with all the brakets in its correct place ...i accidentaly duplicated the comment label

/* USER CODE END 3 */

This made the autogeneration from cubeMx confused and *ate* the last main() closing braket every time i tried to autogenerate the code.

Im thankfull for you help @TDK​ 

we dont need to firmware by ourselves, lets talk