Compiling error STM32F407 SPI /ENC

Limited support for STM32F4 Discovery, Nucleo and custom F4 boards
petit_miner
Posts: 3
Joined: Mon Nov 07, 2016 6:40 pm

Compiling error STM32F407 SPI /ENC

Postby petit_miner » Fri Jan 20, 2017 5:41 pm

Hi there,

I bought myself this development board with an stm32f407 I want to attach the enc60j28 Ethernet Controller.
http://www.ebay.de/itm/Core407V-STM32F407VET6-STM32-Cortex-M4-Development-Board-Core-board-Modul-/381844482282?hash=item58e7b468ea:g:yskAAOSwmLlX18O~

I tried to compile the built in example from the UIPethernet library, but I ran in some issues.
I switched to verbose ouput:

Code: Select all

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip" "-C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\utility" "C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\utility\Enc28J60Network.cpp" -o "C:\Users\mthue\AppData\Local\Temp\arduino_build_489296\libraries\arduino_uip\utility\Enc28J60Network.cpp.o"
C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\utility\Enc28J60Network.cpp:40:8: error: 'SPIClass' does not name a type

 extern SPIClass SPI;

        ^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\utility\Enc28J60Network.cpp: In static member function 'static void Enc28J60Network::init(uint8_t*)':

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\utility\Enc28J60Network.cpp:72:7: error: 'class HardwareSPI' has no member named 'setBitOrder'

   SPI.setBitOrder(MSBFIRST);

       ^
exit status 1
Fehler beim Kompilieren für das Board STM32 Discovery F407.

How I fix this problem?
Somebody recently asked the same question, but they didnt find a solution.
More support for the STM32F4 Series would be beautiful, but a lot of work...

User avatar
martinayotte
Posts: 1151
Joined: Mon Apr 27, 2015 1:45 pm

Re: Compiling error STM32F407 SPI /ENC

Postby martinayotte » Sat Jan 21, 2017 3:23 pm

You need to include SPI.h before UIPEthernet.h and have global instance "SPIClass SPI(1)" in you main sketch.

petit_miner
Posts: 3
Joined: Mon Nov 07, 2016 6:40 pm

Re: Compiling error STM32F407 SPI /ENC

Postby petit_miner » Tue Jan 24, 2017 11:49 am

The include <SPI.h> is already in the example sketch. I dont understand what you mean with SPI Class SPI(1).
I added it in my sketch direct after include <SPI.h>. but I only get SPI Class does not name a type.
I then copied the SPI lib from the STM32F4 folder directly in the UIEthernet (STM32F4) lib folder. (The SPI.h and SPI.cpp file)
Then I got a lot of errors:

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.h:362:17: error: conflicting declaration 'SPIClass SPI'

extern SPIClass SPI;//(1);// dummy params

^

In file included from C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\cores\maple/wirish.h:49:0,

from C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.h:47,

from C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:32:

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\cores\maple/libmaple/HardwareSPI.h:276:20: error: 'SPI' has a previous declaration as 'HardwareSPI SPI'

extern HardwareSPI SPI;

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp: In member function 'uint8 SPIClass::dmaTransfer(uint8*, uint8*, uint16)':

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:380:63: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_attach_interrupt(dma_dev*, dma_stream, void (*)())'

dma_attach_interrupt(DMA1, DMA_CH3, &SPIClass::DMA1_CH3_Event);

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:385:82: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_setup_transfer(dma_dev*, dma_stream, volatile void*, volatile void*, volatile void*, uint32, uint32)'

receiveBuf, DMA_SIZE_8BITS, (DMA_MINC_MODE | DMA_TRNS_CMPLT));// receive buffer DMA

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:386:45: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_set_num_transfers(dma_dev*, dma_stream, uint16)'

dma_set_num_transfers(DMA1, DMA_CH2, length);

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:394:84: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_setup_transfer(dma_dev*, dma_stream, volatile void*, volatile void*, volatile void*, uint32, uint32)'

transmitBuf, DMA_SIZE_8BITS, (DMA_FROM_MEM | DMA_TRNS_CMPLT));// Transmit FF repeatedly

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:398:101: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_setup_transfer(dma_dev*, dma_stream, volatile void*, volatile void*, volatile void*, uint32, uint32)'

transmitBuf, DMA_SIZE_8BITS, (DMA_MINC_MODE | DMA_FROM_MEM | DMA_TRNS_CMPLT));// Transmit buffer DMA

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:400:45: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_set_num_transfers(dma_dev*, dma_stream, uint16)'

dma_set_num_transfers(DMA1, DMA_CH3, length);

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:402:26: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_enable(dma_dev*, dma_stream)'

dma_enable(DMA1, DMA_CH2);// enable receive

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:403:26: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_enable(dma_dev*, dma_stream)'

dma_enable(DMA1, DMA_CH3);// enable transmit

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:419:30: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_disable(dma_dev*, dma_stream)'

dma_disable(DMA1, DMA_CH3);

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:420:27: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_disable(dma_dev*, dma_stream)'

dma_disable(DMA1, DMA_CH2);

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp: In member function 'uint8 SPIClass::dmaSend(uint8*, uint16, bool)':

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:437:63: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_attach_interrupt(dma_dev*, dma_stream, void (*)())'

dma_attach_interrupt(DMA1, DMA_CH3, &SPIClass::DMA1_CH3_Event);

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:442:58: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_setup_transfer(dma_dev*, dma_stream, volatile void*, volatile void*, volatile void*, uint32, uint32)'

transmitBuf, DMA_SIZE_8BITS, flags);// Transmit buffer DMA

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:443:45: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_set_num_transfers(dma_dev*, dma_stream, uint16)'

dma_set_num_transfers(DMA1, DMA_CH3, length);

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:444:26: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_enable(dma_dev*, dma_stream)'

dma_enable(DMA1, DMA_CH3);// enable transmit

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:451:27: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_disable(dma_dev*, dma_stream)'

dma_disable(DMA1, DMA_CH3);

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp: In member function 'uint8 SPIClass::dmaSend(uint16*, uint16, bool)':

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:462:63: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_attach_interrupt(dma_dev*, dma_stream, void (*)())'

dma_attach_interrupt(DMA1, DMA_CH3, &SPIClass::DMA1_CH3_Event);

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:467:59: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_setup_transfer(dma_dev*, dma_stream, volatile void*, volatile void*, volatile void*, uint32, uint32)'

transmitBuf, DMA_SIZE_16BITS, flags);// Transmit buffer DMA

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:468:45: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_set_num_transfers(dma_dev*, dma_stream, uint16)'

dma_set_num_transfers(DMA1, DMA_CH3, length);

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:469:26: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_enable(dma_dev*, dma_stream)'

dma_enable(DMA1, DMA_CH3);// enable transmit

^

C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip\SPI.cpp:476:27: error: cannot convert 'dma_channel' to 'dma_stream' for argument '2' to 'void dma_disable(dma_dev*, dma_stream)'

dma_disable(DMA1, DMA_CH3);

^

Bibliothek arduino_uip in Version 1.04 im Ordner: C:\Users\mthue\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\arduino_uip wird verwendet
exit status 1
Fehler beim Kompilieren für das Board STM32 Discovery F407.
Invalid version found: 1.04
Invalid version found: 1.04

User avatar
martinayotte
Posts: 1151
Joined: Mon Apr 27, 2015 1:45 pm

Re: Compiling error STM32F407 SPI /ENC

Postby martinayotte » Fri Jan 27, 2017 9:13 pm

You should not copy the SPI library, it should stay at its original location.

victor_pv
Posts: 957
Joined: Mon Apr 27, 2015 12:12 pm

Re: Compiling error STM32F407 SPI /ENC

Postby victor_pv » Fri Jan 27, 2017 9:38 pm

From the name of the functions not found, looks like you are trying to use the SPI library from the stm32f1 core.

User avatar
martinayotte
Posts: 1151
Joined: Mon Apr 27, 2015 1:45 pm

Re: Compiling error STM32F407 SPI /ENC

Postby martinayotte » Sat Jan 28, 2017 3:42 pm

Ah ! Ok ! I've recalled now : In my F4 tree, all DMA code is commented out and not in use...


Return to “STM32F4 Boards”

Who is online

Users browsing this forum: No registered users and 1 guest