- Starting with CubeMX and FreeRTOS 9. Got LED’s and printf’s working on UART 3.
- I then replaced the FreeRTOS 9 files with version 10 files from their official SVN repository. This worked.
- I started following the tutorial, copied the IP files over, created a config file, and am stuck at this step: https://www.freertos.org/FreeRTOS-Plus/FreeRTOSPlusTCP/TCPNetworkingTutorialInitialisingTCP.html
FreeRTOS + TCP, tutorial, STM32F7 questions.
I’m trying to build a TCP/IP application using FreeRTOS 10 + TCP/IP on an STM32F767ZI-Nucleo-144 board.
FreeRTOS + TCP, tutorial, STM32F7 questions.
Hi Abe, you can get around the above problem by changing the declaration in your main.c to:
~~~
const uint8t ucMACAddress[ 6 ] = { configMACADDR0, configMACADDR1, configMACADDR2, configMACADDR3, configMACADDR4, configMAC_ADDR5 };
~~~
Here is a post about the recent STM32Fxx driver:
https://sourceforge.net/p/freertos/discussion/382005/thread/e6c5bd5f/?limit=250#fbd7
It needs one of these defines:
STM32F7xx
, STM32F4xx
or STM32F2xx
to indicate the type of CPU. I haven’t tested it on a STM32F2 my self, but it seems to work.
I will attach the latest version here below as “STM32Fxxtcpdriver7Oct_2018.7z”. It won’t refer to ucMACAddress[]
anymore.
Please unpack the 7-zip in “FreeRTOS-Plus-TCPsourceportableNetworkInterface”.
When using this driver, you should also include:
~~~
FreeRTOS-Plus-TCPsourceportableNetworkInterfaceCommonphyHandling.c
~~~
and add this path to the list of include directories:
~~~
FreeRTOS-Plus-TCPsourceportableNetworkInterfaceinclude
~~~
Please tell me how it works for you.
FreeRTOS + TCP, tutorial, STM32F7 questions.
OK, thanks for the info and files. 🙂
I added STM32F7xx to Atollic’s (Eclipse) project symbol list, which solved some of the problems.
I had to remove all the eventLog lines from phyHandling.c (no sign of eventLogging.h anywhere.)
And I also need to paste in a ulApplicationGetNextSequenceNumber function, as found here: https://sourceforge.net/p/freertos/discussion/382005/thread/86b911fb/
FreeRTOS + TCP, tutorial, STM32F7 questions.
I’m not seeing your xCheckLoopback() in FreeRTOSARP.h/c… As mentioned here: https://www.freertos.org/FreeRTOSSupportForumArchive/February2018/freertosFreeRTOS-PlusTCP760109c4j.html
(I’m using latest svn)
It’s also failling on undefined reference to xQueueCreateCountingSemaphore in BufferAllocation2.c, even though I have #define configSUPPORTDYNAMIC_ALLOCATION 1 in FreeRTOSConfig.h. https://www.freertos.org/CreateCounting.html
Thanks. 🙂
FreeRTOS + TCP, tutorial, STM32F7 questions.
Hi, thanks for the feedback.
I had to remove all the eventLog lines from phyHandling.c (no sign of eventLogging.h anywhere.)I think that you used and older file and not the one that I attached yesterday as: STM32Fxxtcpdriver7Oct_2018.7z
eventLog()
is my own thing: it saves strings in a circular buffer, used for “real-time” debugging.
I’m not seeing your xCheckLoopback() in FreeRTOS_ARP.h/c You can find it in this earlier postBut you can also comment it out. I hope that the changes for the loop-back interface can be merged with the FreeRTOS/AWS release. At the same time, the drivers under NetworkInterface must be updated / merged. I think that in order to get
xQueueCreateCountingSemaphore()
compiled, you need these two defines:
~~~
define configUSECOUNTINGSEMAPHORES 1
define configSUPPORTDYNAMICALLOCATION 1
~~~FreeRTOS + TCP, tutorial, STM32F7 questions.
Thanks, Hein, I appreciate your time. I’m still totally confused on bringing in these libraries… :/
Am I using the right SVN repository?
The eventlogging was from my list of compile errors to track down. It was in the SVN.
I created a uxRand() that calls HALRNGGetRandomNumber(&hrng), which is uint32t, but elsewhere unsigned long and elsewhere UBaseTypet. (So many layers of redefinitions!)
Can’t seem to resolve xQueueCreateCountingSemaphore, more layers of nested definitions. I tried adding mpuwrappers.h to NetworkInterface.c, but it didn’t work.
~~~
mpuprototypes.h
95: QueueHandlet MPUxQueueCreateCountingSemaphore( const UBaseTypet uxMaxCount, const UBaseTypet uxInitialCount );
mpuwrappers.h
100: #define xQueueCreateCountingSemaphore MPUxQueueCreateCountingSemaphore
queue.h
1416: QueueHandlet xQueueCreateCountingSemaphore( const UBaseTypet uxMaxCount, const UBaseTypet uxInitialCount ) PRIVILEGEDFUNCTION;
semphr.h
998: #define xSemaphoreCreateCounting( uxMaxCount, uxInitialCount ) xQueueCreateCountingSemaphore( ( uxMaxCount ), ( uxInitialCount ) )
~~~
Also, the stm32fxxhaleth.h you gave me seems to conflict with stm32hallegacy.h.
I tried removing it, but there are a number of other headers that depend on it.
~~~
Drivers/STM32F7xxHALDriver/Inc/Legacy/stm32hallegacy.h
1001:#define ETHMACTXFIFOWRITEACTIVE 0x00400000U /* Tx FIFO write active */
Middlewares/ThirdParty/FreeRTOS-Plus-TCP/portable/NetworkInterface/include/stm32fxxhaleth.h
1249:#define ETHMACTXFIFOWRITEACTIVE ((uint32t)0x00400000) /* Tx FIFO write active */
~~~
FreeRTOS + TCP, tutorial, STM32F7 questions.
Am I using the right SVN repository?You can use SVN : https://sourceforge.net/p/freertos/code/HEAD/tree/ or github : https://github.com/aws/amazon-freertos
The eventlogging was from my list of compile errors to track down. It was in the SVN.It could be that some sources file in the SVN still contained a reference to “eventlogging”. Sorry for that.
I created a uxRand() that calls HALRNGGetRandomNumber(&hrng), which is uint32t, but elsewhere unsigned long and elsewhere UBaseTypet. (So many layers of redefinitions!)
uxRand()
came up a bit /ad hoc/, while the demo sources were being created. It is part of the demo’s, not part of a FreeRTOS library. I’d vote to make it uint32_t
.
Can’t seem to resolve xQueueCreateCountingSemaphore, more layers of nested definitions. Confusing.Have you defined these: ~~~ #define configUSECOUNTINGSEMAPHORES 1 #define configSUPPORTDYNAMICALLOCATION 1 ~~~ already? If so, you get the
xQueueCreateCountingSemaphore()
from task.c
Also, the stm32fxxhaleth.h you gave me seems to conflict with stm32hallegacy.h. I tried removing it, but there are a number of other headers that depend on it.ST’s header file “stm32hallegacy.h” has also gone through a series of changes. In the older versions, it did not define
ETH_MAC_TXFIFO_WRITE_ACTIVE
. In later versions it was defined as:
~~~
define ETHMACTXFIFOWRITEACTIVE ((uint32_t)0x00400000) /* Tx FIFO write active */
~~~ and again later it is defined as: ~~~define ETHMACTXFIFOWRITEACTIVE 0x00400000U /* Tx FIFO write active */
~~~ I don’t know how to handle this. You could put an empty file:portableNetworkInterfaceSTM32Fxxstm32_hal_legacy.h
Or you can define __STM32_HAL_LEGACY
before stm32f7xx_hal.h
gets included.
I mean in “portableNetworkInterfaceSTM32Fxxstm32fxxhaleth.c” :
~~~
/* Includes ——————————————————————*/
+#define __STM32_HAL_LEGACY 1
#if defined(STM32F7xx)
#include “stm32f7xx_hal.h”
#include “stm32f7xx_hal_def.h”
#define stm_is_F7 1
#elif defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
#include “stm32f4xx_hal.h”
#include “stm32f4xx_hal_def.h”
#define stm_is_F4 1
~~~
The NetworkInterface drivers always depend on chip libraries. We had to make some changes to them and therefor we also provided a stm32fxx_hal_eth.h
.
I hope that you can find an easy solutuion to this.
FreeRTOS + TCP, tutorial, STM32F7 questions.
Defining configUSECOUNTINGSEMAPHORES got it to compile. I’ll see if I can progress now.
Thanks! 🙂
FreeRTOS + TCP, tutorial, STM32F7 questions.
I went back to the original SVN code, edited NetworkInterface.c and got rid of all the duplicate definitions. Much simpler for me to stick to the default CMSIS/HAL setup from ST.
Still, thanks for your insight and feedback. I’ve gotten further in the tutorial, (had to account for a few variable name changes since the tutorial), and hopefully, tomorrow, talk to my echo server.
FreeRTOS + TCP, tutorial, STM32F7 questions.
I’ve set FreeRTOSIPconfig.h to DHCP and set printf (through UART) for debug and ipconfig output.
Says Link Status still low regardless of cable inserted or not. The cable lights are on and occasionally blink off. I know this cable works.
Any suggestions?
Thanks.
prvIPTask started
prvEthernetUpdateConfig: LS mask 00 Force 1
Network buffers: 56 lowest 56
Link Status still low
Link Status still low
Link Status still low
Link Status still low
Link Status still low
Link Status still low
Link Status still low
Network buffers: 55 lowest 55
Link Status still low
Link Status still low
Link Status still low
Link Status still low
Link Status still low
Link Status still low
FreeRTOS + TCP, tutorial, STM32F7 questions.
Hi Abe, have you checked two other things: whether the choice for RMII versus MII is made correctly? And also ( related ) if you have configured all Ethernet pins in a correct way?
I went back to the original SVN code, edited NetworkInterface.c and got rid of all the duplicate definitions. Much simpler for me to stick to the default CMSIS/HAL setup from ST.You’re reporting a problem with a driver ( from SVN ) that is outdated. We had good reasons to make changes to that driver. I tested the most recent STM32Fxx driver on my STM32F7 disco board. It would be handy if you can use the latest driver. If you want, tell me which HAL version you’re using and I will try compile it.
FreeRTOS + TCP, tutorial, STM32F7 questions.
Hein, Thanks, I pushed what I have here: https://gitlab.com/abeowitz/netapp
I’m using the HAL drivers from STM32CubeMX (F7 v 1.12), and I’m configured for RMII. The FreeRTOS-IP ones are renamed *.h.bak.
I’ll try the new driver again, but all these different HAL drivers, dependencies and duplicate declarations are a nightmare…
FreeRTOS + TCP, tutorial, STM32F7 questions.
Thanks for uploading your project. I comiled the latest NetworkInterface along with your HAL library, and it really helps to add this patch:
~~~
#include “phyHandling.h”
+#define __STM32HALLEGACY 1
/* ST includes. */
#if defined( STM32F7xx )
#include “stm32f7xx_hal.h”
~~~
When
__STM32_HAL_LEGACY
is defined, stm32_hal_legacy.h
will not be included anymore. And that saves a lot of conflicts.
FreeRTOS + TCP, tutorial, STM32F7 questions.
Wow, thanks! I’ll check this out tonight. (Off to doctor appt.)
I also need to check the docs, as STM32CubeMX hinted that I may need TIM2 connected with TRIG1…
Is your STM32F7 Disco project available online?
FreeRTOS + TCP, tutorial, STM32F7 questions.
Here’s a confusing thing. Atollic(Ecllipse) will automatically edit #includes if I rename the files.
#include “stm32f7xxhaleth.h”
Now I rename stm32f7xxhaleth.h -> stm32f7xxhaleth.h.bak
And Atollic edits the file:
#include “stm32f7xxhaleth.h.bak”
FreeRTOS + TCP, tutorial, STM32F7 questions.
Adding #define STM32HALLEGACY 1 in NetworkInterface.c with your new driver allows me to compile, but nothing works. No interrupts, printf’s, anything. Debugger shows it’s wandering around HAL code.
And I still get a bunch of redefined warnings.
If I define STM32HALLEGACY in main.h, then there are a number of definitions missing. GPIOSPEEDHIGH, for example, is in stm32hallegacy.h.
Seems I need bits and pieces of various headers. And being a newb to the PHY stuff, I’m still confused. :/
FreeRTOS + TCP, tutorial, STM32F7 questions.
Here’s a confusing thing. Atollic(Ecllipse) will automatically edit #includes if I rename the files. #include “stm32f7xxhaleth.h” Now I rename stm32f7xxhaleth.h -> stm32f7xxhaleth.h.bak And Atollic edits the file: #include “stm32f7xxhaleth.h.bak”I think that all Eclipse IDE’s will do that, if… you let the IDE maintain your project. Can you go to the properties of the header file and tick: “exclude resource from build”? I always use “Makefile” projects and import those into Eclipse. A Makefile project can easily be maintained and compiled outside an IDE.
FreeRTOS + TCP, tutorial, STM32F7 questions.
Adding #define STM32_HAL_LEGACY 1
in NetworkInterface.c with your new driver allows me to compile
Great, one step further
In your project, there is still stm32f7xx_hal_eth.c
, can you also exclude that from being built?
In TrueStudio, see its properties, tab “C/C++ build”, tick “Exclude resource from build”.
And also any existing stm32f7xx_hal_eth.h
should be removed or become invisible for the compiler.
The FreeRTOS+TCP driver wants to replace all “stm32f*haleth*” files.
but nothing works. No interrupts, printf’s, anything. Debugger shows it’s wandering around HAL code.Patience, you’ll get that working. I don’t know about the
printf
s because we did not implement them.
And I still get a bunch of redefined warnings. If I define STM32HALLEGACY in main.h, then there are a number of definitions missing. GPIOSPEEDHIGH, for example, is in stm32hallegacy.h.In main.c you do not need
stm32f7xx_hal_eth.h
, so you could define :
~~~
#define __STM32F7xxHALETH_H 1
~~~
To avoid inclusion of that header file, and do not define __STM32_HAL_LEGACY
in your main.c.
I have an STM32F746G DISCO board, which has the same Ethernet connections as your STM32F767ZI-Nucleo-144.
Have you checked ST’s document en.DM00244518.pdf already? It describes the switches that you must set in order to make Ethernet working.
Your board also uses the Reduced Media-Independent Interface, so your `freeRTOSIPConfig.h must define:
~~~
#define ipconfigUSE_RMII 1
~~~
The pins are initialised by HAL_ETH_MspInit()
, which will be called from stm32fxx_hal_eth.c
.
Debugging: could you put a breakpoint within vMACBProbePhy()
? And if it doesn’t get called, please check how far it comes in the function HAL_ETH_Init()
.
FreeRTOS + TCP, tutorial, STM32F7 questions.
I also have an STM32F7 DISCO board…
Would it be too much trouble to ask you to make a simple starter build for me? If so, please start with STM32CubeMX, add FreeRTOS 10 + TCP/IP and generate it for Atollic TrueStudio and just bring it up to FreeRTOS_IPInit() with DHCP.
If I have a working project on the DISCO, I can build my STM32F767ZI project, do a side-by-side comparison, and learn how to put all the pieces together…
FreeRTOS + TCP, tutorial, STM32F7 questions.
Hi Abe, can we connect through email: “hein [at] htibosch [dot] net”?
That will be easier to share projects and code. Thanks,
FreeRTOS + TCP, tutorial, STM32F7 questions.
OK, I will, thanks.
FreeRTOS + TCP, tutorial, STM32F7 questions.
Hello stm32f7 friends,
i think i’m having the same problems. After getting everything up (as i thought). I got many multiple definition errors when compiling:
these are for:
HALETHDMATxDescListInit, HALETHDMARxDescListInit and others in
MiddlewaresThirdPartyFreeRTOS-PlusFreeRTOS-Plus-TCPportableNetworkInterfaceSTM32F7xx/stm32f7xxhaleth.c
and
DriversSTM32F7xxHALDriverSrc/stm32f7xxhal_eth.c
How can I get rid of this?
Philipp
PS: also in atollic true studio of course. Setting up with cubeMX as described on the freeRTOS website
FreeRTOS + TCP, tutorial, STM32F7 questions.
Hi Philipp, in this same post you will see references to the latest STM32Fxx driver.
That was an informal (personal) release.
As you see, it includes a source file called “stm32fxxhaleth.c”. That version was adapted to enable zero-copy transmission and reception of packets.
It look like your Atollic True Studio has included 2 times “stm32fxxhaleth.c”.
Please go to the properties of
DriversSTM32F7xx_HAL_DriverSrc/stm32f7xx_hal_eth.c
and indicate that it should be excluded from building cq. compilation.
That should solve your problem.
Also please make sure that your project has defined:
#define STM32F7xx 1
Hein
FreeRTOS + TCP, tutorial, STM32F7 questions.
Hello Hein,
thank you for the fast response 🙂
i took the files from your link and deleted the ethernet HAL files generated by cubeMX and got the redefinitions error away. But now i got:
phyHandling.c:193: undefined reference to ‘vLoggingPrintf’
But it could also that i missed configuring something. Perhaps, but i dont thinks so, that my FreeRTOSIPconfig.h is not correct. Do you have a sample IPconfig for the f7? I would adapt it for my use…
I would also try to uncomment these loggings…
But i’m a little bit confused now. Which files should one use when bgeinning with the FreeRTOS + TCP with a stm32F7xx. The files from the amazon FreeRTOS github page, the ones from the svn linked on the FreeRTOS website or this one you linked?
And should i enable the ETH connection in cubeMX in RMII model (which seems to generate the duplicated ethernet HAL files but perhaps its important for other things)?
Philipp
FreeRTOS + TCP, tutorial, STM32F7 questions.
Hello again,
so with commenting the vLoggingPrintf’s in the pyHandling i got everything compiled 🙂 I will try pinging the board tomorow 🙂
Philipp
FreeRTOS + TCP, tutorial, STM32F7 questions.
If you’re interesting in the logging, you can replace
vLoggingPrintf()
with FreeRTOS_printf(())
. Please note the double parentheses around the parameter list.
FreeRTOS_printf(())
should be defined in your FreeRTOSIPConfig.h
.
FreeRTOS + TCP, tutorial, STM32F7 questions.
Hello Hein,
thanks for you time again. I have 2 other questions / problems:
I. (not so bad) When I set ipconfigHASPRINTF in FreeRTOSIPconfig.h to 1 my application hangs. It stucks inside HardFaultHandler in stm32f7xxit.c while loop and blocks other tasks. ipconfigHASDEBUG_PRINTF with 1 works just fine. I use for both prints (debug and non debuging messages) an SWV the function:
void FreeRTOSTCPSWOdebug(const char *s)
{
while (*s!=’