STM32F3 SPI bus

An area to discuss ARM specific problems and examples

Moderator: Benj

Post Reply
User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

STM32F3 SPI bus

Post 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
Best Regards FOTIS ANAGNOSTOU

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: STM32F3 SPI bus

Post by Benj »

Hi Fotis,

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

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: STM32F3 SPI bus

Post 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
Best Regards FOTIS ANAGNOSTOU

Post Reply