久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 1939|回復(fù): 1
打印 上一主題 下一主題
收起左側(cè)

STM32F429_USB項(xiàng)目源程序 hal庫(kù)

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:884218 發(fā)表于 2021-2-14 20:01 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
stm32429——usb項(xiàng)目demo,作主機(jī)讀寫(xiě)U盤(pán),親測(cè)成功,可生成寫(xiě)入的txt文件。

單片機(jī)源程序如下:

  1. /* USER CODE END Header */

  2. /* Includes ------------------------------------------------------------------*/
  3. #include "main.h"
  4. #include "dma.h"
  5. #include "spi.h"
  6. #include "usart.h"
  7. #include "gpio.h"

  8. /* Private includes ----------------------------------------------------------*/
  9. /* USER CODE BEGIN Includes */

  10. /* USER CODE END Includes */

  11. /* Private typedef -----------------------------------------------------------*/
  12. /* USER CODE BEGIN PTD */

  13. /* USER CODE END PTD */

  14. /* Private define ------------------------------------------------------------*/
  15. /* USER CODE BEGIN PD */

  16. /* USER CODE END PD */

  17. /* Private macro -------------------------------------------------------------*/
  18. /* USER CODE BEGIN PM */

  19. /* USER CODE END PM */

  20. /* Private variables ---------------------------------------------------------*/

  21. /* USER CODE BEGIN PV */

  22. /* USER CODE END PV */

  23. /* Private function prototypes -----------------------------------------------*/
  24. void SystemClock_Config(void);
  25. /* USER CODE BEGIN PFP */

  26. /* USER CODE END PFP */

  27. /* Private user code ---------------------------------------------------------*/
  28. /* USER CODE BEGIN 0 */

  29. /* USER CODE END 0 */

  30. /**
  31.   * @brief  The application entry point.
  32.   * @retval int
  33.   */
  34. int main(void)
  35. {
  36.   /* USER CODE BEGIN 1 */

  37.   /* USER CODE END 1 */
  38.   

  39.   /* MCU Configuration--------------------------------------------------------*/

  40.   /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  41.   HAL_Init();

  42.   /* USER CODE BEGIN Init */

  43.   /* USER CODE END Init */

  44.   /* Configure the system clock */
  45.   SystemClock_Config();

  46.   /* USER CODE BEGIN SysInit */

  47.   /* USER CODE END SysInit */

  48.   /* Initialize all configured peripherals */
  49.   MX_GPIO_Init();
  50.   MX_DMA_Init();
  51.   MX_SPI1_Init();
  52.   MX_USART1_UART_Init();
  53.   /* USER CODE BEGIN 2 */

  54.   /* USER CODE END 2 */

  55.   /* Infinite loop */
  56.   /* USER CODE BEGIN WHILE */
  57.   while (1)
  58.   {
  59.     /* USER CODE END WHILE */

  60.     /* USER CODE BEGIN 3 */
  61.   }
  62.   /* USER CODE END 3 */
  63. }

  64. /**
  65.   * @brief System Clock Configuration
  66.   * @retval None
  67.   */
  68. void SystemClock_Config(void)
  69. {
  70.   RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  71.   RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

  72.   /** Initializes the CPU, AHB and APB busses clocks
  73.   */
  74.   RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  75.   RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  76.   RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
  77.   RCC_OscInitStruct.HSIState = RCC_HSI_ON;
  78.   RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  79.   RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  80.   RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
  81.   if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  82.   {
  83.     Error_Handler();
  84.   }
  85.   /** Initializes the CPU, AHB and APB busses clocks
  86.   */
  87.   RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
  88.                               |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  89.   RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  90.   RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  91.   RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
  92.   RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

  93.   if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
  94.   {
  95.     Error_Handler();
  96.   }
  97. }

  98. /* USER CODE BEGIN 4 */

  99. /* USER CODE END 4 */

  100. /**
  101.   * @brief  This function is executed in case of error occurrence.
  102.   * @retval None
  103.   */
  104. void Error_Handler(void)
  105. {
  106.   /* USER CODE BEGIN Error_Handler_Debug */
  107.   /* User can add his own implementation to report the HAL error return state */

  108.   /* USER CODE END Error_Handler_Debug */
  109. }

  110. #ifdef  USE_FULL_ASSERT
  111. /**
  112.   * @brief  Reports the name of the source file and the source line number
  113.   *         where the assert_param error has occurred.
  114.   * @param  file: pointer to the source file name
  115.   * @param  line: assert_param error line source number
  116.   * @retval None
  117.   */
  118. void assert_failed(uint8_t *file, uint32_t line)
  119. {
  120.   /* USER CODE BEGIN 6 */
  121.   /* User can add his own implementation to report the file name and line number,
  122.      tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  123.   /* USER CODE END 6 */
  124. }
  125. #endif /* USE_FULL_ASSERT */

  126. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
復(fù)制代碼

所有資料51hei提供下載:
F429_DEMO.7z (2.92 MB, 下載次數(shù): 19)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:83553 發(fā)表于 2021-2-15 10:14 | 只看該作者
樓主是不是傳錯(cuò)文件了?不是429,也不是讀寫(xiě)U盤(pán)
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 亚洲日本一区二区三区四区 | av天天干| 91视频播放| 国产精选一区 | 久久不卡视频 | 日韩综合 | 国产免费一区二区 | 国产精品成人久久久久 | 日韩欧美一区二区三区四区 | 依人成人 | 成人免费观看视频 | 天天曰夜夜 | 大学生a级毛片免费视频 | 国产一区二区在线免费 | 欧美激情精品久久久久 | 91精品亚洲| 情侣黄网站免费看 | 欧美www在线观看 | 欧美亚洲国产一区 | 久久久久久电影 | 看片一区 | 欧美视频在线播放 | 久久久人| 日韩视频一级 | 国产精品视频入口 | 一级黄色片免费在线观看 | 久草免费在线 | 一级黄色片美国 | 国产精品久久av | 日本一区二区高清视频 | 亚洲一区二区三区在线播放 | 午夜影院操 | 国产色99| 亚洲一区视频在线 | 久久久久久免费免费 | 欧美在线播放一区 | 91影院在线观看 | 亚洲精品免费在线观看 | 亚洲在线| 欧美精 | 日韩成人免费 |