Quality RTOS & Embedded Software

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


Loading

lwip port for STM32F107 repeats tx packets

Posted by Joerg Hermann on February 1, 2010
I just started to work with the freeRTOS port including the lwIP stack for the STM32 communication line devices.
Everything works fine, but I found that every packet is sent twice. Diving deeper into the code I found that this
is obviously done intentionally: a field 'SendCount' is maintained with the Tx descriptor, which is evaluated in
the Tx interrupt processing to repeat the last sent packet.
Has anyone an idea, why this is implemented that way?
-
Joerg

RE: lwip port for STM32F107 repeats tx packets

Posted by Richard on February 1, 2010
I would guess the Ethernet driver was copied from a uIP demo. It is quite common in uIP to send packets twice as a technique to speed up the ACK coming back from the other end of the link.

Regards.

RE: lwip port for STM32F107 repeats tx packets

Posted by Stefano Oliveri on February 2, 2010
Hi Joerg,
I observer this behavior and more over I found that the Ethernet driver is configured to work in promiscuous mode.
I propose a fix to both this bugs. You find more information at the following web page http://developers.stf12.net/just-another-eclipse-demo-str91x. See the bug report #B3.3 and #B3.4

Regards,
Stefano

RE: lwip port for STM32F107 repeats tx packets

Posted by Joerg Hermann on February 2, 2010
Hi Stefano,
thanks a lot for your reply. For some reasons I didn't look up the project page....
I'm not sure id the fix you have described there is sufficient.
I modified the source at thres positions:
(1) in xEthInitialise():

/* SendCount must be initialized to 2 to ensure the Tx descriptor looks
as if its available (as if it has already been sent twice. */
xTxDescriptor.SendCount = 2;
xTxDescriptor.SendCount = 1;

(2) in vMAC_ISR()
if (xTxDescriptor.SendCount == 0) {
/* Send again! */
(xTxDescriptor.SendCount)++;
xTxDescriptor.Status = ETH_DMATxDesc_OWN | ETH_DMATxDesc_LS
| ETH_DMATxDesc_FS | ETH_DMATxDesc_TER | ETH_DMATxDesc_TCH
| ETH_DMATxDesc_IC;
ETH->DMASR = ETH_DMASR_TBUS;
ETH->DMATPDR = 0;
vReturnBuffer((unsigned char *) xTxDescriptor.Buffer1Addr);
} else {

(3) in vSendMACData()

while ((xTxDescriptor.SendCount < 2) && (xTxDescriptor.Status & ETH_DMATxDesc_OWN) == ETH_DMATxDesc_OWN) {
while ((xTxDescriptor.SendCount < 1) && (xTxDescriptor.Status & ETH_DMATxDesc_OWN) == ETH_DMATxDesc_OWN) {

At least it seems to work and my peer server application is not longer confused about the duplicated packets ;-)
I will also try the patch to turn off the promiscuous mode; thanks again for the hint.
best regards,
Joerg

RE: lwip port for STM32F107 repeats tx packets

Posted by Joerg Hermann on February 2, 2010
....Sorry, the text got messed up a little bit, since the [ s] tags do not work within [ code].
Read as follows: delete text within [ s] ... [ /s] and replace by the following line(s).
-
Joerg


[ 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