找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4549|回复: 2
打印 上一主题 下一主题
收起左侧

DP83848与STM32F4进行网络通信原理图源程序

[复制链接]
跳转到指定楼层
楼主
DP83848与STM32F4进行网络通信电路原理图如下:


单片机源程序如下:
  1. /* Includes ------------------------------------------------------------------*/
  2. #include "stm32f4x7_eth.h"
  3. #include "netconf.h"
  4. #include "main.h"
  5. #include "lwip/tcp.h"
  6. #include "serial_debug.h"
  7. #include "udp_echoclient.h"

  8. /* Private typedef -----------------------------------------------------------*/
  9. /* Private define ------------------------------------------------------------*/
  10. #define SYSTEMTICK_PERIOD_MS  10

  11. /*--------------- LCD Messages ---------------*/
  12. //#if defined (STM32F40XX)
  13. //#define MESSAGE1   "    STM32F40/41x     "
  14. //#elif defined (STM32F427X)
  15. //#define MESSAGE1   "     STM32F427x      "
  16. //#endif
  17. //#define MESSAGE2   "  STM32F-4 Series   "
  18. //#define MESSAGE3   " UDP echoclient Demo"
  19. //#define MESSAGE4   "                    "

  20. /* Private macro -------------------------------------------------------------*/
  21. /* Private variables ---------------------------------------------------------*/
  22. __IO uint32_t LocalTime = 0; /* this variable is used to create a time reference incremented by 10ms */
  23. uint32_t timingdelay;

  24. /* Private function prototypes -----------------------------------------------*/
  25. //void LCD_LED_BUTTON_Init(void);

  26. /* Private functions ---------------------------------------------------------*/

  27. /**
  28.   * @brief  Main program.
  29.   * @param  None
  30.   * @retval None
  31.   */
  32. int main(void)
  33. {
  34.   /*!< At this stage the microcontroller clock setting is already configured to
  35.        168 MHz, this is done through SystemInit() function which is called from
  36.        startup file (startup_stm32f4xx.s) before to branch to application main.
  37.        To reconfigure the default setting of SystemInit() function, refer to
  38.        system_stm32f4xx.c file
  39.      */

  40.   NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

  41. //#ifdef SERIAL_DEBUG
  42. //  DebugComPort_Init();
  43. //#endif

  44. //  /*Initialize LCD and Leds */
  45. //  LCD_LED_BUTTON_Init();

  46.   /* Configure ethernet (GPIOs, clocks, MAC, DMA) */
  47.   ETH_BSP_Config();

  48.   /* Initilaize the LwIP stack */
  49.   LwIP_Init();

  50.   /* Infinite loop */
  51.   while (1)
  52.   {  
  53.                
  54.     /* check if any packet received */
  55.     if (ETH_CheckFrameReceived())
  56.     {
  57.       /* process received ethernet packet */
  58.       LwIP_Pkt_Handle();
  59.     }
  60.     /* handle periodic timers for LwIP */
  61.     LwIP_Periodic_Handle(LocalTime);
  62.          udp_echoclient_connect();
  63.   }
  64. }

  65. /**
  66.   * @brief  Inserts a delay time.
  67.   * @param  nCount: number of 10ms periods to wait for.
  68.   * @retval None
  69.   */
  70. void Delay(uint32_t nCount)
  71. {
  72.   /* Capture the current local time */
  73.   timingdelay = LocalTime + nCount;  

  74.   /* wait until the desired delay finish */
  75.   while(timingdelay > LocalTime)
  76.   {     
  77.   }
  78. }

  79. /**
  80.   * @brief  Updates the system local time
  81.   * @param  None
  82.   * @retval None
  83.   */
  84. void Time_Update(void)
  85. {
  86.   LocalTime += SYSTEMTICK_PERIOD_MS;
  87. }

  88. ///**
  89. //  * @brief  Initializes STM324xG-EVAL's LCD, LEDs and push-buttons resources.
  90. //  * @param  None
  91. //  * @retval None
  92. //  */
  93. //void LCD_LED_BUTTON_Init(void)
  94. //{
  95. //#ifdef USE_LCD
  96. //  /* Initialize the STM324xG-EVAL's LCD */
  97. //  STM324xG_LCD_Init();
  98. //#endif

  99. //  /* Initialize STM324xG-EVAL's LEDs */
  100. //  STM_EVAL_LEDInit(LED1);
  101. //  STM_EVAL_LEDInit(LED2);
  102. //  STM_EVAL_LEDInit(LED3);
  103. //  STM_EVAL_LEDInit(LED4);

  104. //  /* Leds on */
  105. //  STM_EVAL_LEDOn(LED1);
  106. //  STM_EVAL_LEDOn(LED2);
  107. //  STM_EVAL_LEDOn(LED3);
  108. //  STM_EVAL_LEDOn(LED4);

  109. //#ifdef USE_LCD
  110. //  /* Clear the LCD */
  111. //  LCD_Clear(Black);

  112. //  /* Set the LCD Back Color */
  113. //  LCD_SetBackColor(Black);

  114. //  /* Set the LCD Text Color */
  115. //  LCD_SetTextColor(White);

  116. //  /* Display message on the LCD*/
  117. //  LCD_DisplayStringLine(Line0, (uint8_t*)MESSAGE1);
  118. //  LCD_DisplayStringLine(Line1, (uint8_t*)MESSAGE2);
  119. //  LCD_DisplayStringLine(Line2, (uint8_t*)MESSAGE3);
  120. //  LCD_DisplayStringLine(Line3, (uint8_t*)MESSAGE4);
  121. //#endif
  122. //  
  123. //  STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI);
  124. //}

  125. //#ifdef  USE_FULL_ASSERT

  126. ///**
  127. //  * @brief  Reports the name of the source file and the source line number
  128. //  *   where the assert_param error has occurred.
  129. //  * @param  file: pointer to the source file name
  130. //  * @param  line: assert_param error line source number
  131. //  * @retval None
  132. //  */
  133. //void assert_failed(uint8_t* file, uint32_t line)
  134. //{
  135. //  /* User can add his own implementation to report the file name and line number,
  136. //     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  137. //  /* Infinite loop */
  138. //  while (1)
  139. //  {}
  140. //}
  141. //#endif


  142. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
复制代码

所有资料51hei提供下载:
DP83848-ST(2).7z (1.22 MB, 下载次数: 84)
DP83848C原理图.pdf (173.89 KB, 下载次数: 66)


评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:321859 发表于 2020-1-2 09:38 | 只看该作者
看看,谢大佬分享
回复

使用道具 举报

板凳
ID:699515 发表于 2020-3-3 15:46 | 只看该作者
谢谢分享下载学习啊
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表