2014-06-06 06:42 AM
Hi Al
I have referred to AN3966 (LwIP TCP/IP stack demonstration for STM32F407/STM32F417 microcontrollers) to get LWIP stack for Standalone STM32F407VG. And also i got LWIP stack files from a link.st.com/we
b/en/catal
og/tools/P
F257906
in ST forum but in that link most of the Header files are missing ,So can anyone please suggest how can i achieve LWIP for Standalone STM32F407VG. #off-topic #lmgtfy2014-06-06 08:13 AM
There's that and the Ethernet IAP example.
What header files? Isn't LwIP freely available on the interwebs? Can you not just get that and back port or merge the STM32F2/4, and board specific, code?2014-06-07 05:16 AM
Hi clive
what you have tried with timer 2 (DMA updating the arr ) I have tried with the timer 5.....for timer 2 is working but why not working for timer 5 when both are having the same features. Code is pasted below #include ''unistd.h'' #include ''stm32f4xx.h'' #include ''stm32f4_discovery.h'' #include ''stm32f4xx_tim.h'' #include ''stm32f4xx_rcc.h'' #include ''stm32f4xx.h'' #include <misc.h> #include ''stm32f4xx_adc.h'' #include ''stm32f4xx_gpio.h'' #include ''stm32f4xx_dac.h'' #include ''stm32f4xx_tim.h'' #include ''stm32f4xx_dma.h'' #include ''stm32f4xx_usart.h'' #include ''stm32f4_discovery.h'' #define SAMPLES 4 uint32_t SampleVector[SAMPLES] = { 200, 300, 3200, 12800 }; // TIM2 32-bit /**************************************************************************************/ void RCC_Configuration(void) { /* DMA1 (TIM2 on APB1) clock enable */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1, ENABLE); /* TIM5 clock enable */ RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5, ENABLE); /* GPIOA clock enable */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE); } /**************************************************************************************/ void GPIO_Configuration(void) { GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; // PA1 TIM5_CH2 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_Init(GPIOA, &GPIO_InitStructure); /* Connect TIM2 pin */ GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_TIM5); // PA1 TIM5_CH2 } /**************************************************************************************/ void DMA_Configuration(void) { DMA_InitTypeDef DMA_InitStructure; DMA_DeInit(DMA1_Stream0); DMA_InitStructure.DMA_Channel = DMA_Channel_6; DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&TIM2->ARR; DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)&SampleVector[0]; DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral; DMA_InitStructure.DMA_BufferSize = SAMPLES; DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word; // TIM2 is 32-bit DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word; DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; //DMA_InitStructure.DMA_Mode = DMA_Mode_Normal; DMA_InitStructure.DMA_Priority = DMA_Priority_High; DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable; DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full; DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single; DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single; DMA_Init(DMA1_Stream0, &DMA_InitStructure); DMA_Cmd(DMA1_Stream0, ENABLE); } /**************************************************************************************/ void TIM5_Configuration(void) { TIM_TimeBaseInitTypeDef TIM_InitStruct; TIM_OCInitTypeDef TIM_OCInitStructure; /* Time base configuration */ TIM_InitStruct.TIM_Prescaler = 2 - 1; // This will configure the clock to 32 MHz TIM_InitStruct.TIM_CounterMode = TIM_CounterMode_Up; // Count-up timer mode TIM_InitStruct.TIM_Period = 200 - 1; // 160 KHz initially TIM_InitStruct.TIM_ClockDivision = TIM_CKD_DIV1; // Divide clock by 1 TIM_InitStruct.TIM_RepetitionCounter = 0; // Set to 0, not used TIM_TimeBaseInit(TIM5, &TIM_InitStruct); TIM_ARRPreloadConfig(TIM5, ENABLE); /* Output Compare Toggle Mode configuration: Channel2 - so we can actually measure widths */ TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Toggle; // 80 KHz TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; TIM_OCInitStructure.TIM_Pulse = 1; TIM_OC2Init(TIM5, &TIM_OCInitStructure); /* TIM2 Update Interrupt enable - for whatever purpose, likely to saturate */ TIM_ITConfig(TIM5, TIM_IT_Update, ENABLE); /* TIM2 Update DMA Request enable */ TIM_DMACmd(TIM5, TIM_DMA_Update, ENABLE); /* TIM2 enable counter */ TIM_Cmd(TIM5, ENABLE); } /**************************************************************************************/ void NVIC_Configuration(void) { NVIC_InitTypeDef NVIC_InitStructure; /* Enable TIM5 Interrupt */ NVIC_InitStructure.NVIC_IRQChannel = TIM5_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); } /**************************************************************************************/ void TIM5_IRQHandler(void) { if (TIM_GetITStatus(TIM5, TIM_IT_Update) != RESET) { TIM_ClearITPendingBit(TIM5, TIM_IT_Update); STM_EVAL_LEDToggle(LED3); } } /**************************************************************************************/ int main(void) { RCC_Configuration(); NVIC_Configuration(); GPIO_Configuration(); STM_EVAL_LEDInit(LED3); DMA_Configuration(); TIM5_Configuration(); while(1); // Don't want to exit } /**************************************************************************************/ #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t* file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf(''Wrong parameters value: file %s on line %d\r\n'', file, line) */ /* Infinite loop */ while (1) { } } #endif2014-06-07 05:54 AM
If you have a question about Ethernet or LwIP please use this thread, otherwise start another.
[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/generating%20an%20interrupt%20for%20the%20loaded%20values%20in%20ARR&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=215]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2Fgenerating%20an%20interrupt%20for%20the%20loaded%20values%20in%20ARR&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=2152014-06-08 10:20 PM
2014-06-08 11:17 PM
i searched for Lwip in interweb but i didn't get it. if u know the link to get Lwip plz post the link so that it can help me to move further.
Honestly?http://savannah.nongnu.org/projects/lwip/
http://download.savannah.gnu.org/releases/lwip/
2014-06-09 09:45 PM
Hi clive,
i got LWIP from link but when i try to compile using CoIDE ,it gives a error like arch/cc.h and config.h files are not found. where can i get those files? or am i going wrong in procedure ?2014-06-10 04:24 AM
Hi All,
i got lwip from this link when i try to compile it, its giving a error like config.h file not found. is this config.h is system file?? how can i get config.h file?2014-06-10 07:05 AM
2014-06-10 07:40 AM
Would suggest you review the ''contrib'' related ports, and how the STM32F4 port was achieved.
If there are no compiler/platform issues to address the config.h can be an empty file. STM32F4x7_ETH_LwIP_V1.0.0\Utilities\Third_Party\lwip_v1.3.2\port\STM32F4x7\arch\sys_arch.h