Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

FreeRTOS+UDP port to STM32F429

Posted by beaker1969 on January 28, 2015

Hi

I have been working on porting the FreeRTOS+UDP to the stm32f429 and have successfully got it to work with being able to get responses from ping's from a PC. I have had to make a few changes as explained below.

The STM32F429 has the capability to generate the checksums required for the sections in a packet. when the FreeRTOS responds to an ICMP packet it does a quick re-calculation of the ICMP checksum but this causes the STM32F429 auto calculation of the checksum to fail as it MUST be 0000 when it enters the calculation process.

for STM32F4 - see page 1125 of doc - DM00031020 Reference manual.

      Note that: for ICMP-over-IPv4 packets, the checksum field in 

the ICMP packet must always be 0x0000 in both modes, because pseudo-headers are not defined for such packets. If it does not equal 0x0000, an incorrect checksum may be inserted into the packet.

in order to get round this problem i have used the existing setting called 'ipconfigDRIVERINCLUDEDTXIPCHECKSUM' to decide if the ICMP will be calculated in the routine ''prvProcessICMPEchoRequest' located in 'FReeRTOS_IP.c' as shown below.

original

             if( pxICMPHeader->usChecksum >= FreeRTOS_htons( ( ( 

uint16t ) 0xffffU ) - ( ipICMPECHOREQUEST << ( ( uint16t ) 8U ) ) ) ) { pxICMPHeader->usChecksum = ( uint16t ) ( ( ( uint32t ) pxICMPHeader->usChecksum ) + FreeRTOShtons( ipICMPECHOREQUEST << ( ( uint16t ) 8U ) ) + 1U ); } else { pxICMPHeader->usChecksum = ( uint16t ) ( ( ( uint32t ) pxICMPHeader->usChecksum ) + FreeRTOShtons( ipICMPECHOREQUEST << ( ( uint16t ) 8U ) ) ); }

 replaced by


      //added by AW
     #if( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM == 0 )
     {
     // for STM32F4 - see page 1125 of doc - DM00031020 Reference 

manual. /* * Note that: for ICMP-over-IPv4 packets, the checksum field in the ICMP packet must always be 0x0000 in both modes, because pseudo-headers are not defined for such packets. If it does not equal 0x0000, an incorrect checksum may be inserted into the packet. */ if( pxICMPHeader->usChecksum >= FreeRTOShtons( ( ( uint16t ) 0xffffU ) - ( ipICMPECHOREQUEST << ( ( uint16t ) 8U ) ) ) ) { pxICMPHeader->usChecksum = ( uint16t ) ( ( ( uint32t ) pxICMPHeader->usChecksum ) + FreeRTOShtons( ipICMPECHOREQUEST << ( ( uint16t ) 8U ) ) + 1U ); } else { pxICMPHeader->usChecksum = ( uint16t ) ( ( ( uint32t ) pxICMPHeader->usChecksum ) + FreeRTOShtons( ipICMPECHOREQUEST << ( ( uint16_t ) 8U ) ) ); }

     }    // added by AW
     #else
     {
         pxICMPHeader->usChecksum = 0x0000;
     }
     #endif

if it hasn't already been added the following needs to be added to the FreeRTOSIPConfig.h

define ipconfigDRIVERINCLUDEDTXIPCHECKSUM 1

this allows all the checksums to be calculated by the hardware.

I will keep you updated on my progress in getting more of it working.

Alan


FreeRTOS+UDP port to STM32F429

Posted by rtel on January 28, 2015

Thanks for the very useful post - yes please do keep us updated, and once you are happy with the code please post it to the FreeRTOS Interactive site (http://interactive.freertos.org).

We are currently porting FreeRTOS+TCP to the STM32, although with all the other development work we are doing it will probably be a while before it is released.. FreeRTOS+TCP has a few more options for checksum offloading.

Regards.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner