[工具下载] M051系列BSP也终于升级了

[复制链接]
955|11
 楼主| yiy 发表于 2020-2-17 20:53 | 显示全部楼层 |阅读模式
M051_Series_BSP_CMSIS_V3.01.003.zip (6.36 MB, 下载次数: 17)
 楼主| yiy 发表于 2020-2-17 20:53 | 显示全部楼层
原来是3.00版本,现在终于近期更新了一点了。
 楼主| yiy 发表于 2020-2-17 20:55 | 显示全部楼层
 楼主| yiy 发表于 2020-2-17 20:55 | 显示全部楼层
新版增加了ISP例子,非常丰富,常用的接口方式都提供了。
 楼主| yiy 发表于 2020-2-17 20:55 | 显示全部楼层
不要等了,我去玩起来了,赶紧你也下载吧
 楼主| yiy 发表于 2020-2-17 21:10 | 显示全部楼层
  1. /**************************************************************************//**
  2. * [url=home.php?mod=space&uid=288409]@file[/url]     main.c
  3. * [url=home.php?mod=space&uid=895143]@version[/url]  V3.00
  4. * $Revision: 3 $
  5. * $Date: 15/05/22 2:51p $
  6. * [url=home.php?mod=space&uid=247401]@brief[/url]    Show the usage of GPIO interrupt function.
  7. *
  8. * @note
  9. * Copyright (C) 2013 Nuvoton Technology Corp. All rights reserved.
  10. ******************************************************************************/
  11. #include <stdio.h>
  12. #include "M051Series.h"


  13. #define PLL_CLOCK           50000000


  14. /**
  15. * @brief       Port0/Port1 IRQ
  16. *
  17. * @param       None
  18. *
  19. * [url=home.php?mod=space&uid=266161]@return[/url]      None
  20. *
  21. * [url=home.php?mod=space&uid=1543424]@Details[/url]     The Port0/Port1 default IRQ, declared in startup_M051Series.s.
  22. */
  23. void GPIOP0P1_IRQHandler(void)
  24. {
  25.     /* To check if P1.3 interrupt occurred */
  26.     if(GPIO_GET_INT_FLAG(P1, BIT3))
  27.     {
  28.         GPIO_CLR_INT_FLAG(P1, BIT3);
  29.         printf("P1.3 INT occurred.\n");
  30.     }
  31.     else
  32.     {
  33.         /* Un-expected interrupt. Just clear all PORT0, PORT1 interrupts */
  34.         P0->ISRC = P0->ISRC;
  35.         P1->ISRC = P1->ISRC;
  36.         printf("Un-expected interrupts.\n");
  37.     }
  38. }

  39. /**
  40. * @brief       Port2/Port3/Port4 IRQ
  41. *
  42. * @param       None
  43. *
  44. * @return      None
  45. *
  46. * @details     The Port2/Port3/Port4 default IRQ, declared in startup_M051Series.s.
  47. */
  48. void GPIOP2P3P4_IRQHandler(void)
  49. {
  50.     /* To check if P4.5 interrupt occurred */
  51.     if(GPIO_GET_INT_FLAG(P4, BIT5))
  52.     {
  53.         GPIO_CLR_INT_FLAG(P4, BIT5);
  54.         printf("P4.5 INT occurred.\n");
  55.     }
  56.     else
  57.     {
  58.         /* Un-expected interrupt. Just clear all PORT2, PORT3 and PORT4 interrupts */
  59.         P2->ISRC = P2->ISRC;
  60.         P3->ISRC = P3->ISRC;
  61.         P4->ISRC = P4->ISRC;
  62.         printf("Un-expected interrupts.\n");
  63.     }
  64. }

  65. void SYS_Init(void)
  66. {
  67.     /*---------------------------------------------------------------------------------------------------------*/
  68.     /* Init System Clock                                                                                       */
  69.     /*---------------------------------------------------------------------------------------------------------*/
  70.     /* Enable Internal RC 22.1184MHz clock */
  71.     CLK_EnableXtalRC(CLK_PWRCON_OSC22M_EN_Msk);

  72.     /* Waiting for Internal RC clock ready */
  73.     CLK_WaitClockReady(CLK_CLKSTATUS_OSC22M_STB_Msk);

  74.     /* Switch HCLK clock source to Internal RC and HCLK source divide 1 */
  75.     CLK_SetHCLK(CLK_CLKSEL0_HCLK_S_HIRC, CLK_CLKDIV_HCLK(1));

  76.     /* Enable external XTAL 12MHz clock */
  77.     CLK_EnableXtalRC(CLK_PWRCON_XTL12M_EN_Msk);

  78.     /* Waiting for external XTAL clock ready */
  79.     CLK_WaitClockReady(CLK_CLKSTATUS_XTL12M_STB_Msk);

  80.     /* Set core clock as PLL_CLOCK from PLL */
  81.     CLK_SetCoreClock(PLL_CLOCK);

  82.     /* Enable UART module clock */
  83.     CLK_EnableModuleClock(UART0_MODULE);

  84.     /* Select UART module clock source */
  85.     CLK_SetModuleClock(UART0_MODULE, CLK_CLKSEL1_UART_S_PLL, CLK_CLKDIV_UART(1));

  86.     /*---------------------------------------------------------------------------------------------------------*/
  87.     /* Init I/O Multi-function                                                                                 */
  88.     /*---------------------------------------------------------------------------------------------------------*/

  89.     /* Set P3 multi-function pins for UART0 RXD and TXD */
  90.     SYS->P3_MFP &= ~(SYS_MFP_P30_Msk | SYS_MFP_P31_Msk);
  91.     SYS->P3_MFP |= (SYS_MFP_P30_RXD0 | SYS_MFP_P31_TXD0);

  92. }

  93. void UART0_Init(void)
  94. {
  95.     /*---------------------------------------------------------------------------------------------------------*/
  96.     /* Init UART                                                                                               */
  97.     /*---------------------------------------------------------------------------------------------------------*/
  98.     /* Reset UART0 */
  99.     SYS_ResetModule(UART0_RST);

  100.     /* Configure UART0 and set UART0 Baudrate */
  101.     UART_Open(UART0, 115200);
  102. }

  103. /*---------------------------------------------------------------------------------------------------------*/
  104. /* MAIN function                                                                                           */
  105. /*---------------------------------------------------------------------------------------------------------*/
  106. int main(void)
  107. {
  108.     /* Unlock protected registers */
  109.     SYS_UnlockReg();

  110.     /* Init System, peripheral clock and multi-function I/O */
  111.     SYS_Init();

  112.     /* Lock protected registers */
  113.     SYS_LockReg();

  114.     /* Init UART0 for printf */
  115.     UART0_Init();

  116.     printf("\n\nCPU [url=home.php?mod=space&uid=72445]@[/url] %d Hz\n", SystemCoreClock);
  117.     printf("+------------------------------------------------+\n");
  118.     printf("|    GPIO P1.3 and P4.5 Interrupt Sample Code    |\n");
  119.     printf("+------------------------------------------------+\n\n");

  120.     /*-----------------------------------------------------------------------------------------------------*/
  121.     /* GPIO Interrupt Function Test                                                                        */
  122.     /*-----------------------------------------------------------------------------------------------------*/
  123.     printf("P1.3 and P4.5 are used to test interrupt ......\n");

  124.     /* Configure P1.3 as Input mode and enable interrupt by rising edge trigger */
  125.     GPIO_SetMode(P1, BIT3, GPIO_PMD_INPUT);
  126.     GPIO_EnableInt(P1, 3, GPIO_INT_RISING);
  127.     NVIC_EnableIRQ(GPIO_P0P1_IRQn);

  128.     /*  Configure P4.5 as Quasi-bidirection mode and enable interrupt by falling edge trigger */
  129.     GPIO_SetMode(P4, BIT5, GPIO_PMD_QUASI);
  130.     GPIO_EnableInt(P4, 5, GPIO_INT_FALLING);
  131.     NVIC_EnableIRQ(GPIO_P2P3P4_IRQn);

  132.     /* Waiting for interrupts */
  133.     while(1);
  134. }

  135. /*** (C) COPYRIGHT 2013 Nuvoton Technology Corp. ***/
小灵通2018 发表于 2020-2-17 21:23 | 显示全部楼层
多谢分享,M051开发板的资料哪儿下载啊
小灵通2018 发表于 2020-2-17 21:27 | 显示全部楼层
电脑没有光驱,读不了原来的盘
huahuagg 发表于 2020-2-17 21:28 | 显示全部楼层
好久没来了,来了就有惊喜
幸福小强 发表于 2020-2-17 22:40 | 显示全部楼层
下载,明天研究研究变化。
幸福小强 发表于 2020-2-17 22:41 | 显示全部楼层
是不是之前有什么BUG,优化好了。
cos12a 发表于 2020-8-14 19:08 | 显示全部楼层
jlink 能仿M051系列吗?还是非要NuLink/?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

yiy

114

主题

1954

帖子

4

粉丝
快速回复 在线客服 返回列表 返回顶部