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

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