Page 1 of 1

STM32F3 SPI bus

Posted: Tue Feb 18, 2020 10:05 am
by fotios
Hi
I try to compile an FC in which I also have included the SPI function.
The SPI ports are undeclared?
My target is STM32F303RE.
In my hardware, I have two peripherals connected at SPI1 and SPI3.
Here the error message

Code: Select all

 
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c: In function 'FC_CAL_SPI_Master_Init_1':
SalcombeV1.0_RTC.c:255:27: error: 'port' undeclared (first use in this function)
 #define MX_SPI_SCK_PORT_1 port
                           ^
C:\Program Files (x86)\Flowcode 7\CAL\internals.c:65:26: note: in expansion of macro 'MX_SPI_SCK_PORT_1'
  #define CAL_APD(a, b)   a##b
                          ^
C:\Program Files (x86)\Flowcode 7\CAL\internals.c:66:28: note: in expansion of macro 'CAL_APD'
  #define CAL_APPEND(a, b)  CAL_APD(a, b)
                            ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c:50:28: note: in expansion of macro 'CAL_APPEND'
 #define MX_SPI_SCK_PORT_X  CAL_APPEND(MX_SPI_SCK_PORT_, MX_SPI_NUM)
                            ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c:218:17: note: in expansion of macro 'MX_SPI_SCK_PORT_X'
   HAL_GPIO_Init(MX_SPI_SCK_PORT_X, &GPIO_InitStruct);
                 ^
SalcombeV1.0_RTC.c:255:27: note: each undeclared identifier is reported only once for each function it appears in
 #define MX_SPI_SCK_PORT_1 port
                           ^
C:\Program Files (x86)\Flowcode 7\CAL\internals.c:65:26: note: in expansion of macro 'MX_SPI_SCK_PORT_1'
  #define CAL_APD(a, b)   a##b
                          ^
C:\Program Files (x86)\Flowcode 7\CAL\internals.c:66:28: note: in expansion of macro 'CAL_APD'
  #define CAL_APPEND(a, b)  CAL_APD(a, b)
                            ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c:50:28: note: in expansion of macro 'CAL_APPEND'
 #define MX_SPI_SCK_PORT_X  CAL_APPEND(MX_SPI_SCK_PORT_, MX_SPI_NUM)
                            ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c:218:17: note: in expansion of macro 'MX_SPI_SCK_PORT_X'
   HAL_GPIO_Init(MX_SPI_SCK_PORT_X, &GPIO_InitStruct);
                 ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c: In function 'FC_CAL_SPI_Master_Uninit_1':
SalcombeV1.0_RTC.c:255:27: error: 'port' undeclared (first use in this function)
 #define MX_SPI_SCK_PORT_1 port
                           ^
C:\Program Files (x86)\Flowcode 7\CAL\internals.c:65:26: note: in expansion of macro 'MX_SPI_SCK_PORT_1'
  #define CAL_APD(a, b)   a##b
                          ^
C:\Program Files (x86)\Flowcode 7\CAL\internals.c:66:28: note: in expansion of macro 'CAL_APD'
  #define CAL_APPEND(a, b)  CAL_APD(a, b)
                            ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c:50:28: note: in expansion of macro 'CAL_APPEND'
 #define MX_SPI_SCK_PORT_X  CAL_APPEND(MX_SPI_SCK_PORT_, MX_SPI_NUM)
                            ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c:246:17: note: in expansion of macro 'MX_SPI_SCK_PORT_X'
   HAL_GPIO_Init(MX_SPI_SCK_PORT_X, &GPIO_InitStruct);
                 ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c: In function 'FC_CAL_SPI_Master_Init_2':
SalcombeV1.0_RTC.c:179:27: error: 'port' undeclared (first use in this function)
 #define MX_SPI_SCK_PORT_2 port
                           ^
C:\Program Files (x86)\Flowcode 7\CAL\internals.c:65:26: note: in expansion of macro 'MX_SPI_SCK_PORT_2'
  #define CAL_APD(a, b)   a##b
                          ^
C:\Program Files (x86)\Flowcode 7\CAL\internals.c:66:28: note: in expansion of macro 'CAL_APD'
  #define CAL_APPEND(a, b)  CAL_APD(a, b)
                            ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c:50:28: note: in expansion of macro 'CAL_APPEND'
 #define MX_SPI_SCK_PORT_X  CAL_APPEND(MX_SPI_SCK_PORT_, MX_SPI_NUM)
                            ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c:218:17: note: in expansion of macro 'MX_SPI_SCK_PORT_X'
   HAL_GPIO_Init(MX_SPI_SCK_PORT_X, &GPIO_InitStruct);
                 ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c: In function 'FC_CAL_SPI_Master_Uninit_2':
SalcombeV1.0_RTC.c:179:27: error: 'port' undeclared (first use in this function)
 #define MX_SPI_SCK_PORT_2 port
                           ^
C:\Program Files (x86)\Flowcode 7\CAL\internals.c:65:26: note: in expansion of macro 'MX_SPI_SCK_PORT_2'
  #define CAL_APD(a, b)   a##b
                          ^
C:\Program Files (x86)\Flowcode 7\CAL\internals.c:66:28: note: in expansion of macro 'CAL_APD'
  #define CAL_APPEND(a, b)  CAL_APD(a, b)
                            ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c:50:28: note: in expansion of macro 'CAL_APPEND'
 #define MX_SPI_SCK_PORT_X  CAL_APPEND(MX_SPI_SCK_PORT_, MX_SPI_NUM)
                            ^
C:\Program Files (x86)\Flowcode 7\CAL\STARM\STARM_CAL_SPI.c:246:17: note: in expansion of macro 'MX_SPI_SCK_PORT_X'
   HAL_GPIO_Init(MX_SPI_SCK_PORT_X, &GPIO_InitStruct);
                 ^
Error(s) in build

C:\Program Files (x86)\Flowcode 7\compilers\STARM\batch\stm32comp.bat reported error code 1

Thanks

Re: STM32F3 SPI bus

Posted: Tue Feb 18, 2020 10:56 am
by Benj
Hi Fotis,

Have you assigned the remap pins using the component properties?
Props.jpg
Props.jpg (55.9 KiB) Viewed 4653 times

Re: STM32F3 SPI bus

Posted: Tue Feb 18, 2020 12:18 pm
by fotios
Hi Ben
Oops! :oops: You are right, I forgot it.
It compiles successfully now.
And the best is that it works flawlessly on my actual hardware as I can read back the last data that I've sent to the peripheral. :D
Thanks a lot