Anda di halaman 1dari 17

USB Mass Storage Device Bootloader

Derek Snell – Field Application Engineer


September 5th 2008
TM

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2008.
Low and Full-Speed USB Solutions from Freescale
MCF532x* MCF532x*
LCD LCD
MCF537x MCF537x
Ethernet Ethernet

MCF527x
*Supports hi-
Ethernet speed with
Performance (MHz)

external
ULPI PHY
MCF5222x

MCF5221x Key
Device
MCF51JM128
Host
9S08JM60/32 On-The-Go
(OTG)
9S08JM16/8
Integrated Peripherals

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 2


USB-MINI Stack for S08JM Developed by Freescale

Freescale also provides a USB-MINI Stack supporting the S08 JM family with
USB device function, which is highly optimized for smallest foot print HID
class.

The USB_MINI Stack by Freescale supports:


Applications examples
• HID Class (Mouse)
• General Application
 USB – SCI/SPI/IIC Bridge
 USB Data Logger
 USB Protocol Sniffers
• USB Bootloader
 Update Firmware by USB
 Project template and library are provided
Application notes are available with the
source code.

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 3


USB MSD Bootloader

Mass Storage Device bootloader is available for


in-field updates.
This bootloader enumerates as a removable drive. Then an S19 file
from CodeWarrior with a new application can be copied to the drive.
The bootloader parses the S19 file and updates the application.

ADVANTAGES:
No Host software or drivers required. Uses generic MSD class
Operating System indifferent. Will work on any OS that handles USB
Very simple to use. Just Drag-and-Drop new S19 file
Software available today (we will use it today).
AppNote coming soon.

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 4


FTF 2008 Badge Board – Front Picture

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 5


FTF 2008 Badge Board – Back Picture

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 6


FTF 2008 Badge Board Features

Uses the following Freescale Components:


MCF51JM128 – Flexis V1 MCU with USB OTG
MPR083 – Proximity Touch Sensor with 8 keys
MMA7260QT – 3-Axis Accelerometer
MC34673 – Li-Ion Battery Charger

Features:
Pre-Loaded with fun software, games, change LED text
Pre-loaded with USB MSD Bootloader for firmware updates
Self-Powered, but can charge from USB or wall adapter
SD Card slot for external memory
IR transmitter and expansion connector for off-board communication

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 7


Reset MSD Bootloader Flowchart

No Yes
Jump to User Bootloader Enumerate as
Entry Vector Mode? USB MSD

Main()

No Write SCSI Read


Is Write Send
to Root Dir? Command
Received? FAT info

Yes

Parse S19 File

Erase/Program
Flash
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 8


Lab 5 – USB MSD Bootloader

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 9


Lab 5 – USB MSD Bootloader

Objective: This lab shows how simple the new USB Mass Storage Device
bootloader is to use.

Program the board with the bootloader and application.


Enter Bootloader mode, and watch MSD Enumeration
Copy a different S19 file to board through USB
Verify Application has been updated

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 10


Lab 5 – USB MSD Bootloader

1. Remove both USB cables from the board. Swap the daughter card to use the
MCF51JM128 module.

2. Open CodeWarrior for Microcontrollers. From Windows start menu, you can locate
it using the “Programs>Freescale CodeWarrior>CW for Microcontroller
V6.x>CodeWarrior IDE.exe” path.

3. From CodeWarrior startup dialog, click on “Start Using CodeWarrior”.

4. Note new project directory. Open the USB Bootloader example project by pressing
“CTRL” + “O” keys simultaneously. Follow D:\Hands On
Labs\AMF_IND_T0039\Bootloader USB MSD\Application LED PTE2
blinks with bootloader and select “Application LED PTE2 blinks with
bootloader.mcp” and click “Open”.
5. With board turned off and attach both USB cables between host and board.

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 11


Lab 5 – USB MSD Bootloader

6. Turn the Power switch to the ON position. The Power and USB LED will illuminate.

7. Compile and program the MCF51JM128 microcontroller with USB Bootloader and
application by clicking on “Debug” button, launching debugger.

8. From Connection Manager menu, select “DEMOJM on USB1” port and click on
“Connect (Reset)”.

9. From Erase and Program Flash menu, click on “Yes” to allow the debugger to mass
erase the microcontroller’s on-chip flash memory and program it with the new
application.

10. Close debugger.

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 12


Lab 5 – USB MSD Bootloader

11. Reset the board. The board is currently in Application Mode. Notice our
application blinks LED PTE2

12. Enter Bootloader mode: hold down the switch for PTG0 while resetting. Release
PTG0. Notice PTE2 LED no longer flashes, and another USB device enumerates.

13. Bootloader has enumerated as a Mass Storage Device, and appears as a


Removable Drive. Open “My Computer” to verify the new drive is present. Open
the drive, and notice a file is shown called “READY.TXT. This status shows the
bootloader is ready to accept a new application file

14. Open directory “D:\Products\Applications\USB\AMF-IND-T0039\Bootloader USB


MSD\S19 Files” and find S19 file named “JM128
Application_Only_LED_PTF1_blinks.abs.S19”

15. Copy S19 file onto drive of bootloader. Wait for copy operation to finish (it takes a
few seconds).

16. Reset the board. Notice that this time a different LED, PTF1 blinks instead. The
original application has been erased with the new software from the S19 file.

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 13


Lab 5 – USB MSD Bootloader

17. Also notice that the bootloader drive disappeared. By resetting the board,
Application Mode was entered, and the Mass Storage Device did not enumerate.

18. Feel free to copy the other JM128 S19 file back on the board using the same
steps as before. This loads the original application back on the board and blinks
LED PTE2. Notice this directory also contains S19 files for the new Kirin3 part.
These files won’t work on the JM128, but the same bootloader will be available for
Kirin3.

19. Disconnect device from board when completed.

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 14


FAT16

Bootloader “Speaks FAT16” enough to allow host to read drive


Sector 0 is Boot Sector
• Sets up sector and cluster info so host knows where to find data
• Points to File Allocation Table
• Points to Root Directory
File Allocation Table – Appears to be empty
Root Directory
• Appears to only have one empty file, used for status
• When bootloader mode entered, this file is “READY.TXT”
• “STARTED.TXT” means file transfer has begun
• “SUCCESS.TXT” means S19 file successfully received and
programmed
• “SFAILED.TXT” means there was an error in the S19 file read
• “FFAILED.TXT” means there was an error in erasing or programming
the flash
Bootloader FAT is not changed when host writes a file

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 15


Current Bootloader Status

What is Done:
Bootloader is currently working on V1 and V2 using the JM128 and
Kirin3 MCF5225x.
Bootloader works great and fully tested on Windows XP. Also
working on Windows Vista

What Needs to be Done:


Bootloader for S08 still needs to be finished.
Work out kinks with Linux/Mac

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 16


TM

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are TM

the property of their respective owners. © Freescale Semiconductor, Inc. 2008. 17

Anda mungkin juga menyukai