娇小w搡bbbb搡bbb,《第一次の人妻》,中国成熟妇女毛茸茸,边啃奶头边躁狠狠躁视频免费观看

歷史上的今天

今天是:2024年10月12日(星期六)

正在發生

2019年10月12日 | LPC2148像往U盤拷貝文件一樣更新用戶程序

發布者:快樂微笑 來源: eefocus關鍵字:LPC2148  U盤  拷貝文件  更新用戶程序 手機看文章 掃描二維碼
隨時隨地手機看文章

在網上爬行了很久才找到一個介紹USBMEM_BOOTLOADER的且有源代碼的論壇,用KEIL 編譯后結果不能運行,后來才找到問題的根源:
//usbhw.c
void USB_Init (void) {
  PINSEL1 &= ~0xC000C000;
//PINSEL1 |=  0x40004000;  //這是原來的程序
  PINSEL1 |=  0x80004000;     /* Select USB Link, VBUS */

原來得改一下才能用到我的板子上面。

另外,原來的程序是在復位時檢測P0.15是否為低來判斷是進入用戶程序,還是USB IAP程序,我針對我的板子改了一下,我用了兩個按鈕來控制它,當按下P0.21的按鈕時運行用戶程序,當按下P0.22的按鈕時則運行USB IAP程序:

首先要在sbl_config.h中做一下修改:

#define USER_START_SECTOR 2   //用戶程序起始扇區
#define MAX_USER_SECTOR 26    //最大扇區    LPC2146是 14,LPC2148是26

#define ISP_ENTRY_GPIO_REG 0xE0028000                  /* Port */
#define ISP_ENTRY_PIN21            21          /* User Code Pin  */ //這里原來是 15
#define ISP_ENTRY_PIN22            22          /* USB IAP Pin  */  //這個是增加的

然后把sbl_iap.c里面的相關內容修改一下:

void check_isp_entry_pin(void)
{
while(1)
  {
    if(!( (*(volatile unsigned *)ISP_ENTRY_GPIO_REG) & (0x1<        {
            execute_user_code(); break;
        }
        if(!( (*(volatile unsigned *)ISP_ENTRY_GPIO_REG) & (0x1<        {
         break;   // Enter ISP mode
        }
  }
}

現在就可以來實驗一下了:
ourdev_433852.JPG 
usbmem程序的設置 


boot程序按照這個設置編譯程序,要輸出HEX文件,然后試用ISP工具將其下載到LPC2148中。


現在按一下復位按鈕,按K1(P0.21)沒有反應,因為現在還沒有用戶程序;按一下K2(P0.22),指示燈亮了,此時電腦會顯示發現了新硬件:
ourdev_433853.JPG 
電腦中出現了一個可移動磁盤 
打開這個磁盤,會發現里面有一個文件是492K,
ourdev_433854.JPG 
得把這個文件刪除掉才能拷貝入你自己的程序 
然后再編譯用戶程序,要把起始位置修改為0x2000;同時要輸出BIN文件:(在user  run  寫入fromelf --bin .FlashBlinky.axf -o .FlashBlinky.bin)把得到的BIN文件拷貝入空白的磁盤:
ourdev_433855.JPG 
拷入用戶程序 
按一下復位鍵,再按一下K1,就開始運行流水燈程序了。

單片機源程序如下:

  1. /*----------------------------------------------------------------------------

  2. *      U S B  -  K e r n e l

  3. *----------------------------------------------------------------------------

  4. *      Name:    USBUSER.C

  5. *      Purpose: USB Custom User Module

  6. *      Version: V1.10

  7. *----------------------------------------------------------------------------

  8. *      This software is supplied "AS IS" without any warranties, express,

  9. *      implied or statutory, including but not limited to the implied

  10. *      warranties of fitness for purpose, satisfactory quality and

  11. *      noninfringement. Keil extends you a royalty-free right to reproduce

  12. *      and distribute executable files created using this software for use

  13. *      on Philips LPC2xxx microcontroller devices only. Nothing else gives

  14. *      you the right to use this software.

  15. *

  16. *      Copyright (c) 2005-2006 Keil Software.

  17. *---------------------------------------------------------------------------*/


  18. #include                         /* LPC214x definitions */


  19. #include "type.h"


  20. #include "usb.h"

  21. #include "usbcfg.h"

  22. #include "usbhw.h"

  23. #include "usbcore.h"

  24. #include "usbuser.h"

  25. #include "mscuser.h"


  26. #include "memory.h"



  27. /*

  28. *  USB Power Event Callback

  29. *   Called automatically on USB Power Event

  30. *    Parameter:       power: On(TRUE)/Off(FALSE)

  31. */


  32. #if USB_POWER_EVENT

  33. void USB_Power_Event (BOOL  power) {

  34. }

  35. #endif



  36. /*

  37. *  USB Reset Event Callback

  38. *   Called automatically on USB Reset Event

  39. */


  40. #if USB_RESET_EVENT

  41. void USB_Reset_Event (void) {

  42.   USB_ResetCore();

  43.   IOCLR1 = LED_CFG;                         /* Turn Off Cfg LED */

  44. }

  45. #endif



  46. /*

  47. *  USB Suspend Event Callback

  48. *   Called automatically on USB Suspend Event

  49. */


  50. #if USB_SUSPEND_EVENT

  51. void USB_Suspend_Event (void) {

  52.   IOSET1 = LED_SUSP;                        /* Turn On Suspend LED */

  53. }

  54. #endif



  55. /*

  56. *  USB Resume Event Callback

  57. *   Called automatically on USB Resume Event

  58. */


  59. #if USB_RESUME_EVENT

  60. void USB_Resume_Event (void) {

  61.   IOCLR1 = LED_SUSP;                        /* Turn Off Suspend LED */

  62. }

  63. #endif



  64. /*

  65. *  USB Remote Wakeup Event Callback

  66. *   Called automatically on USB Remote Wakeup Event

  67. */


  68. #if USB_WAKEUP_EVENT

  69. void USB_WakeUp_Event (void) {

  70. }

  71. #endif



  72. /*

  73. *  USB Start of Frame Event Callback

  74. *   Called automatically on USB Start of Frame Event

  75. */


  76. #if USB_SOF_EVENT

  77. void USB_SOF_Event (void) {

  78. }

  79. #endif



  80. /*

  81. *  USB Error Event Callback

  82. *   Called automatically on USB Error Event

  83. *    Parameter:       error: Error Code

  84. */


  85. #if USB_ERROR_EVENT

  86. void USB_Error_Event (DWORD error) {

  87. }

  88. #endif



  89. /*

  90. *  USB Set Configuration Event Callback

  91. *   Called automatically on USB Set Configuration Request

  92. */


  93. #if USB_CONFIGURE_EVENT

  94. void USB_Configure_Event (void) {


  95.   if (USB_Configuration) {                  /* Check if USB is configured */

  96.     IOSET1 = LED_CFG;                       /* Turn On Cfg LED */

  97.   } else {

  98.     IOCLR1 = LED_CFG;                       /* Turn Off Cfg LED */

  99.   }

  100. }

  101. #endif



  102. /*

  103. *  USB Set Interface Event Callback

  104. *   Called automatically on USB Set Interface Request

  105. */


  106. #if USB_INTERFACE_EVENT

  107. void USB_Interface_Event (void) {

  108. }

  109. #endif



  110. /*

  111. *  USB Set/Clear Feature Event Callback

  112. *   Called automatically on USB Set/Clear Feature Request

  113. */


  114. #if USB_FEATURE_EVENT

  115. void USB_Feature_Event (void) {

  116. }

  117. #endif



  118. #define P_EP(n) ((USB_EP_EVENT & (1 << (n))) ? USB_EndPoint##n : NULL)


  119. /* USB Endpoint Events Callback Pointers */

  120. void (* const USB_P_EP[16]) (DWORD event) = {

  121.   P_EP(0),

  122.   P_EP(1),

  123.   P_EP(2),

  124.   P_EP(3),

  125.   P_EP(4),

  126.   P_EP(5),

  127.   P_EP(6),

  128.   P_EP(7),

  129.   P_EP(8),

  130.   P_EP(9),

  131.   P_EP(10),

  132.   P_EP(11),

  133.   P_EP(12),

  134.   P_EP(13),

  135.   P_EP(14),

  136.   P_EP(15),

  137. };



  138. /*

  139. *  USB Endpoint 1 Event Callback

  140. *   Called automatically on USB Endpoint 1 Event

  141. *    Parameter:       event

  142. */


  143. void USB_EndPoint1 (DWORD event) {

  144. }



  145. /*

  146. *  USB Endpoint 2 Event Callback

  147. *   Called automatically on USB Endpoint 2 Event

  148. *    Parameter:       event

  149. */


  150. void USB_EndPoint2 (DWORD event) {


  151.   switch (event) {

  152.     case USB_EVT_OUT:

  153.       MSC_BulkOut();

  154.       break;

  155.     case USB_EVT_IN:

  156.       MSC_BulkIn();

  157.       break;

  158.   }

  159. }



  160. /*

  161. *  USB Endpoint 3 Event Callback

  162. *   Called automatically on USB Endpoint 3 Event

  163. *    Parameter:       event

  164. */


  165. void USB_EndPoint3 (DWORD event) {

  166. }



  167. /*

  168. *  USB Endpoint 4 Event Callback

  169. *   Called automatically on USB Endpoint 4 Event

  170. *    Parameter:       event

  171. */


  172. void USB_EndPoint4 (DWORD event) {

  173. }



  174. /*

  175. *  USB Endpoint 5 Event Callback

  176. *   Called automatically on USB Endpoint 5 Event

  177. *    Parameter:       event

  178. */


  179. void USB_EndPoint5 (DWORD event) {

  180. }



  181. /*

  182. *  USB Endpoint 6 Event Callback

  183. *   Called automatically on USB Endpoint 6 Event

  184. *    Parameter:       event

  185. */


  186. void USB_EndPoint6 (DWORD event) {

  187. }



  188. /*

  189. *  USB Endpoint 7 Event Callback

  190. *   Called automatically on USB Endpoint 7 Event

  191. *    Parameter:       event

  192. */


  193. void USB_EndPoint7 (DWORD event) {

  194. }



  195. /*

  196. *  USB Endpoint 8 Event Callback

  197. *   Called automatically on USB Endpoint 8 Event

  198. *    Parameter:       event

  199. */


  200. void USB_EndPoint8 (DWORD event) {

  201. }



  202. /*

  203. *  USB Endpoint 9 Event Callback

  204. *   Called automatically on USB Endpoint 9 Event

  205. *    Parameter:       event

  206. */


  207. void USB_EndPoint9 (DWORD event) {

  208. }



  209. /*

  210. *  USB Endpoint 10 Event Callback

  211. *   Called automatically on USB Endpoint 10 Event

  212. *    Parameter:       event

  213. */


  214. void USB_EndPoint10 (DWORD event) {

  215. }



  216. /*

  217. *  USB Endpoint 11 Event Callback

  218. *   Called automatically on USB Endpoint 11 Event

  219. *    Parameter:       event

  220. */


  221. void USB_EndPoint11 (DWORD event) {

  222. }



  223. /*

  224. *  USB Endpoint 12 Event Callback

  225. *   Called automatically on USB Endpoint 12 Event

  226. ……………………


  227. …………限于本文篇幅 余下代碼請從51黑下載附件…………



0.png 
關鍵字:LPC2148  U盤  拷貝文件  更新用戶程序 引用地址:LPC2148像往U盤拷貝文件一樣更新用戶程序

上一篇:LPC2000系列Proteus仿真+代碼 菜鳥的ARM學習筆記
下一篇:LPC2000系列ARM芯片的電子琴的設計

0

推薦閱讀

2018華為全聯接大會(HUAWEI CONNECT 2018)于10月10日-12日在上海世博展覽館和世博中心隆重舉行。本屆大會以“+智能,見未來”為主題,為全球ICT產業搭建了一個開放、合作、共享的平臺。?哈曼受華為邀請出席了此次盛會,并在10月11日下午為與會嘉賓帶來“防范自動駕駛汽車即將面臨的下一次網絡攻擊”主題演講。?根據FORBES公司的預測,到2020年全球將...
中國儲能網訊:云貴互聯通道工程全面建設 近日,云貴互聯通道工程開始全面建設。工程由南方電網超高壓輸電公司負責建設,是國內首個將兩端直流改為三端直流的±500千伏直流輸電工程。該工程輸電規模300萬千瓦,在云南新建祿勸換流站,新建一回直流線路,途經云南貴州兩省四市九縣區,接入已經建成的貴州送廣東第一條直流輸電通道,形成跨云南-貴州-廣東...
據外媒報道,當地時間10月9日,歐洲電動汽車電池制造商InoBat Auto(InoBat)的首席執行官Marian Bocek在一份聲明中表示,將在全球發布首款“智能”電動汽車電池。Bocek表示,經過一年的研發,InoBat推出了全球首款將人工智能(AI)與高通量(HTP)技術相結合的電池。(圖片來源:InoBat Auto)與標準研究方法相比,InoBat的電池生產法可以更快、更高效...
隨著智能駕駛和智能座艙時代到來以及AI技術的興起,汽車智能化成為了當前全球各個企業的目標和需求導向,自動駕駛和智能座艙在當前和未來的汽車開發和應用場景中備受關注,這對AI芯片需求量大大增加,也對當前AI芯片及芯片廠商提出更高挑戰。在自動駕駛和智能座艙領域,目前英偉達、英特爾、德州儀器等不少芯片國際巨頭公司已布局良久。在此背景下,國產AI...

史海拾趣

問答坊 | AI 解惑

sch中做元件時如何選擇管腳的電氣特性

請問各位大蝦,sch中做元件時如何選擇管腳的電氣特性? 是不是不做仿真的畫就不要定義電氣特性,都選擇passive?謝謝!…

查看全部問答∨

RS-485接口保護電路綜合版本,比較專業

----處理閃電和ESD感應情況的最好方法是從敏感元件上將瞬態電壓轉移走。一般由一個并聯連接的保護器件完成。發生瞬態事件時,瞬態電流通過瞬態抑制器分流,使被保護電路上的電壓降低。…

查看全部問答∨

【PDF】便攜式產品電源管理的新方案

【PDF】便攜式產品電源管理的新方案…

查看全部問答∨

找工作,大伙幫幫忙。。。

春節回來后,在家里待了一個多月。 做不成的事,重新認識了自己, 明白了安心做技術, 看看壇子里哪個大哥那缺人, 幫忙留意一下 謝謝 現在,看看行情,原則上可以即時到任 可能過清明吧。。。 本人適應能力強,北待過天津,西到過成都,家 ...…

查看全部問答∨

急需熟悉uCOS的高手,有報酬

所在公司的一個項目,比較類似于手持gps。 大致上硬件環境就是FPGA的開發板,Altera的2c系列,采用nios的軟核cpu。 開發環境就是NIOSII 6.1,c語言。 具體要實現的具體功能已經部分有一些代碼,測試功能用。 現在想加操作系統,需要高手幫忙。 ...…

查看全部問答∨

CFL/LED照明驅動IC應用設計全攻略

隨著全球各國政府將節能減排列為重要工作,作為能源消耗大戶的照明成為節能減排追捧的對象,各國政府紛紛推出淘汰白熾燈的時間表,不過隨著白熾燈的淡出,另一個問題產生了――誰能取代白熾燈的照明地位?很多人認為是LED照明,但是由于成本、使用 ...…

查看全部問答∨

STM32103怎么快速對GPIO口進行原子操作?

                                 STM32103怎么快速對GPIO口進行原子操作?…

查看全部問答∨

關于STM32各系列最高主頻

你好,香主,請問一下STM32各系列最高主頻是多少? 我印象中好像以前看到過一張表還是哪個文檔里面寫過這個,現在忘記具體在哪里了。 謝謝!…

查看全部問答∨

請幫忙看看這是什么元器件

3EW85和43A,010(電阻在100k左右)J226L是什么?EES86和VU LPSPHM, K23V5M4PM [ 本帖最后由 michaellyx123 于 2011-8-16 22:32 編輯 ]…

查看全部問答∨

求dcdc的IC

大家好,我現在計劃用單電源5V得到正負15V的電壓,不知道各位大蝦是否有這樣的芯片可以推薦。…

查看全部問答∨
小廣播
添点儿料...
无论热点新闻、行业分析、技术干货……
設計資源 培訓 開發板 精華推薦

最新單片機文章
何立民專欄 單片機及嵌入式寶典

北京航空航天大學教授,20余年來致力于單片機與嵌入式系統推廣工作。

 
EEWorld訂閱號

 
EEWorld服務號

 
汽車開發圈

 
機器人開發圈

電子工程世界版權所有 京ICP證060456號 京ICP備10001474號-1 電信業務審批[2006]字第258號函 京公網安備 11010802033920號 Copyright ? 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
主站蜘蛛池模板: 马边| 丹东市| 天等县| 梅州市| 若羌县| 化隆| 贵溪市| 嘉黎县| 嘉峪关市| 青浦区| 光山县| 无为县| 青川县| 华阴市| 德昌县| 乌什县| 隆化县| 什邡市| 通江县| 佛学| 伽师县| 阿勒泰市| 刚察县| 凌源市| 乌拉特前旗| 玉屏| 贡觉县| 兴文县| 曲沃县| 盐城市| 喜德县| 镇坪县| 宣武区| 霞浦县| 芜湖市| 睢宁县| 漠河县| 包头市| 兰坪| 海晏县| 广饶县|