Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




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 ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists