This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
大家好!
我想我在生成用于对某个函数进行编程的文件时犯了一个错误、 EK-TM4C123GXL 使用 LM 闪存编程器 实现 USB DFU 。 目前、我不打算进行任何自定义实施、无论是在 uC 上还是在主机上。 我的意思是、我将坚持 ROM TivaWare 的香草函数、使用基于 project0等的默认 USB id。
我想我最终需要解决的问题是:我应该为 CCS 项目 生成一个可用于对系统进行编程的文件、 EK-TM4C123GXL 使用 LM 闪存编程器 过孔 USB DFU ?
这是我尝试过的方法:
如果我对 Ek 直接来自 CSS , 启动加载程序 在 uC 运行中和 LM 闪存编程器 在选择该模式时能够看到该模式并使其可再次进行编程、 手动配置 和 USB DFU 作为接口。 这意味着我的 UC 应用程序、主机 Windows 机器及其驱动程序都可以。
但是、此时、当加载.bin (从 CSS 项目 )只是保持 UC 不工作,随后无法通过其重新编程 启动加载程序 。
我认为问题不是.bin。 如果我恢复 uC (直接从 CSS ),然后使用 LM 闪存编程器 选择 个人资料: TM4C123G LaunchPad 在相同的.bin 下、设备正常工作。 但是、 再次将非常相同的.bin LM 闪存编程器 但使用 DFU ,使设备无法工作。
我怀疑 LM 闪存编程器 可能需要一个不同的文件(.bin 除外)来告知它有关存储器位置的信息。 顺便说一下、我延迟的是 ROM_UpdateUSB (0) 我已经检查并确认项目的.cmd 文件与 TivaWare 2.2.0.295 版本、并具有以下地址:
#define APP_BASE 0x00000000 #define RAM_BASE 0x20000000
这使我 认为我不必更改地址字段中的值为0 LM 闪存编程器 ,这似乎是唯一的 变量。
如有任何帮助,将不胜感激。
我的意思是,我要坚持使用 ROM TivaWare 的香草函数,使用基于 project0等的默认 USB id [/ quoto][/quote]但是,此时,当加载.bin (取自 CSS 项目 )只是保持 UC 不工作,随后无法通过其重新编程 启动加载程序 .[/报价]复位后 ROM 引导加载程序的工作方式是、它将首先查找由地址0x0和0x4处的非 F 值指示的有效应用程序。 这两个位置包含堆栈指针和复位矢量。 首次加载 project0示例后、无论您是通过 JTAG 还是 DFU 加载、0x0和0x4处的地址都将变为有效。 重置周期后的下一次、ROM 引导加载程序会发现已经存在有效的应用程序(project0示例)、它会跳转到应用程序并执行。 project0示例是一个仅用于切换 LED 的简单示例。 除非修改示例、否则示例中没有代码可跳回 ROM 引导加载程序。 在闪存中已经存在某个应用程序后、唯一覆盖它的方法是使用 CCS/LM 闪存编程器/Uniflash 通过 JTAG。 或者您也可以再次擦除闪存。 通过擦除闪存、地址位置0x0和0x4将包含所有0xF 值。 复位后、ROM 引导加载程序将检测到不存在有效的应用程序、因此会运行 ROM DFU 引导加载程序以再次重新加载应用程序固件、无论是 project0示例还是任何其他程序。
如果您希望应用通过调用 ROM_UpdateUSB 跳回 ROM 引导加载程序、请参阅 C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\boot_demo_USB 示例。 这是 TM4C129的一个示例、您可以参考并迁移到 TM4C123。 非常仔细地阅读示例说明、这样您就不会将固件加载到板上的 ICDI MCU。 电路板上有两个 MCU。 一个是目标 MCU、另一个作为 ICDI 调试探针进行枚举。 两者都将显示为支持 DFU 的器件。 如果您将示例固件加载到 ICDI MCU、您将使 ICDI 变砖、它不可恢复。
//! <h1>Boot Loader USB Demo (boot_demo_usb)</h1>
//!
//! This example application is used in conjunction with the USB boot loader in
//! ROM and turns the development board into a composite device supporting a
//! mouse via the Human Interface Device class and also publishing runtime
//! Device Firmware Upgrade (DFU) capability. Pressing USR_SW1 will trigger
//! the USB mouse interface to move the cursor in a square pattern once. This
//! is a basic example of how HID reports are sent to the USB host in order to
//! demonstrate controlling the mouse pointer on the host system.
//!
//! Since the device also publishes a DFU interface, host software such as the
//! dfuprog tool can determine that the device is capable of receiving software
//! updates over USB. The runtime DFU protocol allows such tools to signal the
//! device to switch into DFU mode and prepare to receive a new software image.
//!
//! Runtime DFU functionality requires only that the device listen for a
//! particular request (DETACH) from the host and, when this is received,
//! transfer control to the USB boot loader via the normal means to re-enumerate
//! as a pure DFU device capable of uploading and downloading firmware images.
//!
//! Windows device drivers for both the runtime and DFU mode of operation can
//! be found in <tt>C:/TI/TivaWare_C_Series-x.x/windows_drivers</tt> assuming
//! you installed TivaWare in the default directory.
//!
//! To illustrate runtime DFU capability, use the <tt>dfuprog</tt> tool which
//! is part of the Tiva Windows USB Examples package (SW-USB-win-xxxx.msi)
//! Assuming this package is installed in the default location, the
//! <tt>dfuprog</tt> executable can be found in the
//! <tt>C:/Program Files/Texas Instruments/Tiva/usb_examples</tt> or
//! <tt>C:/Program Files (x86)/Texas Instruments/Tiva/usb_examples</tt>
//! directory.
//!
//! With the device connected to your PC and the device driver installed, enter
//! the following command to enumerate DFU devices:
//!
//! <tt>dfuprog -e</tt>
//!
//! This will list all DFU-capable devices found and you should see that you
//! have one or two devices available which are in ``Runtime'' mode.
//!
//! *** IMPORTANT - PLEASE READ ***
//! If you see two devices, it is strongly recommended that you disconnect
//! ICDI debug port from the PC, and change the POWER_SELECT jumper (JP1)
//! from 'ICDI' to 'OTG' in order to power the LaunchPad from the USB
//! OTG port. The reason for this is that the ICDI chip on the board is
//! a DFU-capable TM4C129x device, and if not careful, the firmware on the
//! ICDI chip could be accidently erased which can not restored easily.
//! As a result, debug capabilities would be lost!
//! *** IMPORTANT - PLEASE READ ***
//!
//! If IDCI debug port is disconnected from your PC, you should see only one
//! device from above command, and its index should be 0, and should be named
//! as ``Mouse with Device Firmware Upgrade''.
//! If for any reason you need to keep the ICDI port connected, the above
//! command should show two devices. The second device is probably named as
//! ``In-Circuit Debug interface'', and we need to be careful not to update
//! the firmware on that device. So please take careful note of the index for
//! the device ``Mouse with Device Firmware Upgrade'', it could be 0 or 1, we
//! will need this index number for the following command.
//! Entering the following command will switch this device into DFU mode and
//! leave it ready to receive a new firmware image:
//!
//! <tt>dfuprog -i index -m</tt>
//!
//! After entering this command, you should notice that the device disconnects
//! from the USB bus and reconnects again. Running ``<tt>dfuprog -e</tt>'' a
//! second time will show that the device is now in DFU mode and ready to
//! receive downloads. At this point, either LM Flash Programmer or dfuprog
//! may be used to send a new application binary to the device.
尊敬的 Charles:
感谢您的及时响应。
似乎我在解释我的设置时没有正确地表达自己。 当我提到 项目0 而我应该说的是,我的 CSS 项目是基于该模板。 我的应用正在运行的实际代码只有一项任务:调用引导加载程序、显然它可以正常运行。
在 EK 的 uC (但仅通过 ICDI)上使用其.bin 并对其进行编程:重置后的 uC 在 Windows 计算机上进行枚举、以允许通过 USB DFU 加载新程序。 但我采用了相同的.bin (正在工作)并现在使用 USB DFU 接口(而不是 ICDI)加载它、uC 无法启动。
这就是为什么我怀疑.bin 不是可用于 USB DFU 的正确文件、或者缺少 LM 闪存编程器加载程序的额外信息。
编辑:这里是我在 Project0模板上使用的代码:
#include <stdbool.h> #include <stdint.h> #include "inc/hw_gpio.h" #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "inc/hw_sysctl.h" #include "inc/hw_types.h" #include "inc/hw_nvic.h" #include "driverlib/debug.h" #include "driverlib/gpio.h" #include "driverlib/interrupt.h" #include "driverlib/sysctl.h" #include "driverlib/pin_map.h" #include "driverlib/timer.h" #include "driverlib/uart.h" #include "driverlib/ssi.h" #include "driverlib/rom.h" void JumpToBootLoader(void) { // Configure the required pins for USB operation. ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_5 | GPIO_PIN_4); // Disable all interrupts. ROM_IntMasterDisable(); // We must make sure we turn off SysTick and its interrupt before entering // the boot loader! ROM_SysTickIntDisable(); ROM_SysTickDisable(); // Disable all processor interrupts. Instead of disabling them // one at a time, a direct write to NVIC is done to disable all // peripheral interrupts. HWREG(NVIC_DIS0) = 0xffffffff; HWREG(NVIC_DIS1) = 0xffffffff; HWREG(NVIC_DIS2) = 0xffffffff; HWREG(NVIC_DIS3) = 0xffffffff; HWREG(NVIC_DIS4) = 0xffffffff; // Enable and reset the USB peripheral. ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_USB0); ROM_SysCtlUSBPLLEnable(); while(!ROM_SysCtlPeripheralReady(SYSCTL_PERIPH_USB0)) { } // Re-enable interrupts at the NVIC level. ROM_IntMasterEnable(); ROM_UpdateUSB(0); } void main(void) { ROM_FPULazyStackingEnable(); // Set the system clock to run from the PLL at 80MHz. SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_INT | SYSCTL_XTAL_16MHZ); // Wait a bit SysCtlDelay(3); // Transfer control to the boot loader. JumpToBootLoader(); }
您好!
不能仅仅通过修改 project0示例来简单地调用 rom_UpdateUSB ()。 您的代码不会作为 USB DFU 或任何 USB 设备呈现到主机。 您的代码只能设置时钟并立即跳转到 ROM 引导加载程序、而无需首先初始化 USB 并使用主机正确枚举。 这不奏效。 相同的类比、您不能仅调用 ROM_UpdateEMAC 或 ROM_UpdateUART、并希望它在没有初始化这些模块的情况下开始从以太网或 UART 接口进行引导加载。 请参考 boot_demo_usb 示例。
亲爱的查尔斯:
我已经解决了我的问题。 整个问题都是 EK-TM4C123GXL 上使用的 USB 连接器太糟糕了。 这种线索是 Windows 机器在意外触摸 USB 电缆后在 DFU 模式下识别到 EK 时突然发出提示音。 在不同的 EKS 上的每一个其他测试与正确的代码,我在工作前在 POST 完美。
但我想对你以前的答复表示失望。 当我阅读您在上一篇文章中所说的内容时、我真的对我发表的内容感到怀疑、甚至对我多年来使用的设备的了解也是如此。
在我介绍的代码中、自定义函数 JumpToBootLoader 将负责系统和 USB 准备工作。 我想您错过了这个、只是跳到了结论中。
总之、谢谢。