[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] PPPoS: ppp session disconnect if hit bad fcs for LCP pa
From: |
Sylvain Rochet |
Subject: |
Re: [lwip-users] PPPoS: ppp session disconnect if hit bad fcs for LCP packet |
Date: |
Tue, 18 Jul 2017 11:39:30 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi Axel,
On Sun, Jul 16, 2017 at 02:51:01PM +0800, Axel Lin wrote:
>
> I'm running on a STM32F4 platform.
>
> The driver uses below settings:
>
> /* Fill init structure with common DMA settings */
> dma_init_structure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
> dma_init_structure.DMA_MemoryInc = DMA_MemoryInc_Enable;
> dma_init_structure.DMA_Priority = DMA_Priority_VeryHigh;
> dma_init_structure.DMA_FIFOMode = DMA_FIFOMode_Disable;
> dma_init_structure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
> dma_init_structure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
> dma_init_structure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
>
> /* Initialise RX DMA */
> DMA_DeInit( peripheral->rx_dma_config.stream );
> dma_init_structure.DMA_Channel =
> peripheral->rx_dma_config.channel;
> dma_init_structure.DMA_PeripheralBaseAddr = (uint32_t)
> &peripheral->port->DR;
> dma_init_structure.DMA_Memory0BaseAddr = 0;
> dma_init_structure.DMA_DIR = DMA_DIR_PeripheralToMemory;
> dma_init_structure.DMA_BufferSize = 0xFFFF;
> // This parameter will be configured during communication
> dma_init_structure.DMA_Mode = DMA_Mode_Normal;
> DMA_Init( peripheral->rx_dma_config.stream, &dma_init_structure );
>
> driver->peripheral->rx_dma_config.stream->NDTR = size; // 4096
> driver->peripheral->rx_dma_config.stream->M0AR = (uint32_t)data;
> driver->peripheral->rx_dma_config.stream->CR |= DMA_SxCR_EN;
> USART_DMACmd( driver->peripheral->port, USART_DMAReq_Rx, ENABLE );
>
> The driver uses DMA with circular mode, (the buffer size is 4096).
> I'm still not clear why always lost 63 chars.
> But it looks like not lwip problem but uart driver problem.
dma_init_structure.DMA_Mode = DMA_Mode_Normal;
Are you sure that's circular ? If I remember correctly STM32 shitty DMA
controller doesn't support DMA auto restart in normal mode (next pointer
feature), so you might lost a few bytes when restarting DMA after a DMA
interrupt in normal mode.
Thank you Patrick for the deep analysis of the bytestream ! :)
Sylvain
signature.asc
Description: Digital signature