Microchip ATSAMD20J18 Handleiding


Lees hieronder de 📖 handleiding in het Nederlandse voor Microchip ATSAMD20J18 (32 pagina's) in de categorie Niet gecategoriseerd. Deze handleiding was nuttig voor 19 personen en werd door 2 gebruikers gemiddeld met 4.5 sterren beoordeeld

Pagina 1/32
Atmel Microcontrollers
AT09339: USB Host Interface (UHI) for Mass
Storage Class (MSC)
APPLICATION NOTE
Introduction
USB Host Interface (UHI) for Mass Storage Class (MSC) provides an
interface for the configuration and management of USB MSC host.
The outline of this documentation is as follows:
•API Overview
•Quick Start Guide for USB Host Mass-Storage Module (UHI MSC)
•Configuration File Examples
For more details for Atmel® Software Framework (ASF) USB Host Stack,
refer to following application note:
•AVR4950: ASF - USB Host Stack
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
Table of Contents
Introduction......................................................................................................................1
1. Software License....................................................................................................... 4
2. API Overview.............................................................................................................5
2.1. Variable and Type Definitions....................................................................................................... 5
2.1.1. Type uhi_msc_scsi_callback_t...................................................................................... 5
2.2. Structure Definitions..................................................................................................................... 5
2.2.1. Struct uhi_msc_lun_t..................................................................................................... 5
2.3. Macro Definitions..........................................................................................................................5
2.3.1. Interface with USB Host Core (UHC).............................................................................5
2.4. Function Definitions......................................................................................................................5
2.4.1. Functions Required by UHC.......................................................................................... 5
2.4.2. UHI for Mass Storage Class.......................................................................................... 6
2.4.3. USB Host Mass Storage Interface for Control Access Module......................................8
2.5. Enumeration Definitions..............................................................................................................11
2.5.1. Enum lun_status_t....................................................................................................... 11
3. Quick Start Guide for USB Host Mass-Storage Module (UHI MSC)........................12
3.1. Basic Use Case..........................................................................................................................12
3.1.1. Setup Steps................................................................................................................. 12
3.1.2. Usage Steps................................................................................................................ 12
3.2. Advanced Use Cases.................................................................................................................13
3.3. Enable USB High Speed Support.............................................................................................. 13
3.3.1. Setup Steps................................................................................................................. 13
3.3.2. Usage Steps................................................................................................................ 13
3.4. Multiple Classes Support............................................................................................................13
3.4.1. Setup Steps................................................................................................................. 14
3.4.2. Usage Steps................................................................................................................ 14
3.5. Dual Roles Support.................................................................................................................... 14
3.5.1. Setup Steps................................................................................................................. 14
3.5.2. Usage Steps................................................................................................................ 14
4. Configuration File Examples....................................................................................16
4.1. conf_usb_host.h......................................................................................................................... 16
4.1.1. UHI MSC Single...........................................................................................................16
4.1.2. UHI MSC Multiple (Composite)....................................................................................17
4.2. conf_clock.h................................................................................................................................18
4.2.1. AT32UC3A0, AT32UC3A1, and AT32UC3B Devices (USBB)..................................... 18
4.2.2. AT32UC3A3 and AT32UC3A4 Devices (USBB with High Speed Support)................. 18
4.2.3. AT32UC3C, ATUCXXD, ATUCXXL3U, and ATUCXXL4U Devices (USBC)................19
4.2.4. SAM3X and SAM3A Devices (UOTGHS: USB OTG High Speed)..............................20
4.3. conf_clocks.h..............................................................................................................................21
4.3.1. SAM D21 Devices (USB).............................................................................................21
4.4. conf_board.h...............................................................................................................................24
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
2
4.4.1. AT32UC3A0, AT32UC3A1, and AT32UC3B Devices (USBB)..................................... 24
4.4.2. AT32UC3A3 and AT32UC3A4 Devices (USBB with High Speed Support)................. 24
4.4.3. AT32UC3C, ATUCXXD, ATUCXXL3U, and ATUCXXL4U Devices (USBC)................24
4.4.4. SAM3X and SAM3A Devices (UOTGHS: USB OTG High Speed).............................. 25
4.4.5. SAM D21 Devices (USB).............................................................................................26
5. USB Host Basic Setup.............................................................................................27
5.1. USB Host User Configuration.....................................................................................................27
5.2. USB Host User Callback............................................................................................................ 27
5.3. USB Host Setup Steps............................................................................................................... 28
5.3.1. USB Host Controller (UHC) - Prerequisites................................................................. 28
5.3.2. USB Host Controller (UHC) - Example Code.............................................................. 28
5.3.3. USB Device Controller (UHC) - Workflow....................................................................29
5.4. conf_clock.h Examples...............................................................................................................29
6. Document Revision History..................................................................................... 31
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
3
1. Software License
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
3. The name of Atmel may not be used to endorse or promote products derived from this software without
specific prior written permission.
4. This software may only be redistributed and used in connection with an Atmel microcontroller product.
THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND SPECIFICALLY
DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
4
2. API Overview
2.1. Variable and Type Definitions
2.1.1. Type uhi_msc_scsi_callback_t
typedef void (* uhi_msc_scsi_callback_t )(bool)
Callback type used by uhi_msc_scsi() functions.
2.2. Structure Definitions
2.2.1. Struct uhi_msc_lun_t
Logical Unit Number (LUN) structure information.
Table 2-1. Members
Type Name Description
bool b_write_protected Write protect enable
struct sbc_read_capacity10_data capacity SBC-2 read capacity (10) parameter data
lun_status_t status Status of LUN
2.3. Macro Definitions
2.3.1. Interface with USB Host Core (UHC)
Definition and functions required by UHC.
2.3.1.1. Macro UHI_MSC
#define UHI_MSC
Global definition which contains standard UHI API for UHC. It must be added in USB_HOST_UHI
definition from conf_usb_host.h file.
2.4. Function Definitions
2.4.1. Functions Required by UHC
2.4.1.1. Function uhi_msc_install()
Install interface.
uhc_enum_status_t uhi_msc_install(
uhc_device_t * dev)
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
5
Allocate interface endpoints if supported.
Table 2-2. Parameters
Data direction Parameter name Description
[in] uhc_device_t Device to request
Returns
Status of the install.
2.4.1.2. Function uhi_msc_enable()
Enable the interface.
void uhi_msc_enable(
uhc_device_t * dev)
Enable a USB interface corresponding to UHI.
Table 2-3. Parameters
Data direction Parameter name Description
[in] uhc_device_t Device to request
2.4.1.3. Function uhi_msc_uninstall()
Uninstall the interface (if installed).
void uhi_msc_uninstall(
uhc_device_t * dev)
Table 2-4. Parameters
Data direction Parameter name Description
[in] uhc_device_t Device to request
2.4.2. UHI for Mass Storage Class
Common APIs used by high level application to use this USB host class.
2.4.2.1. Function uhi_msc_is_available()
Tests if the interface UHI Mass Storage is available.
bool uhi_msc_is_available( )void
The UHI Mass Storage can be busy during the enumeration of a USB Device MSC.
Returns
True, if UHI Mass Storage is available.
2.4.2.2. Function uhi_msc_get_lun()
Gives the number of LUN available.
uint8_t void uhi_msc_get_lun( )
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
6
Note:  A LUN can be available, but with a status LUN_NOT_PRESENT.
It is the case for a card reader without card.
Returns
Number of LUN available.
2.4.2.3. Function uhi_msc_get_lun_desc()
Gives information about a LUN.
uhi_msc_lun_t * uhi_msc_get_lun_desc(
lun)uint8_t
Table 2-5. Parameters
Data direction Parameter name Description
[in] lun LUN number
Returns
Pointer on the LUN information structure.
2.4.2.4. Function uhi_msc_scsi_test_unit_ready()
Checks and update the status of the LUN.
bool uhi_msc_scsi_test_unit_ready(
lun,uint8_t
uhi_msc_scsi_callback_t callback)
Table 2-6. Parameters
Data direction Parameter name Description
[in] lun LUN number
[in] callback Callback to call at the end of SCSI command
Returns
True, if the Small Computer System Interface (SCSI) command has been accepted.
2.4.2.5. Function uhi_msc_scsi_read_10()
Reads a LUN data section to RAM buffer.
bool uhi_msc_scsi_read_10(
lun,uint8_t
addr,uint32_t
* ram,uint8_t
nb_sector,uint8_t
uhi_msc_scsi_callback_t callback)
Note:  The sector size used to define the data section is the sector size returned by LUN in field.
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
7
Table 2-7. Parameters
Data direction Parameter name Description
[in] lun LUN number
[in] addr Sector address to read
[out] ram RAM address used to store the data
[in] nb_sector Number of sector to read
[in] callback Callback to call at the end of SCSI command
Returns
True, if the SCSI command has been accepted.
2.4.2.6. Function uhi_msc_scsi_write_10()
Writes a RAM buffer in a LUN data section.
bool uhi_msc_scsi_write_10(
lun,uint8_t
addr,uint32_t
* ram,const uint8_t
nb_sector,uint8_t
uhi_msc_scsi_callback_t callback)
Note:  The sector size used to define the data section is the sector size returned by LUN in field.
Table 2-8. Parameters
Data direction Parameter name Description
[in] lun LUN number
[in] addr Sector address to write
[in] ram RAM address of data to write
[in] nb_sector Number of sector to write
[in] callback Callback to call at the end of SCSI command
Returns
True, if the SCSI command has been accepted.
2.4.3. USB Host Mass Storage Interface for Control Access Module
Layer added on UHI MSC interface to allow the usage of control access module. The control access
module provides a common access at all memories and it is used by the File Systems available in ASF.
2.4.3.1. Function uhi_msc_mem_get_lun()
Gives the number of available LUN.
uint8_t void uhi_msc_mem_get_lun( )
Note:  A LUN can be available, but with a status not present.
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
8
It is the case for a card reader without card.
Returns
Number of available LUN.
2.4.3.2. Function uhi_msc_mem_test_unit_ready()
Checks and update the status of the LUN.
Ctrl_status uhi_msc_mem_test_unit_ready(
lun)uint8_t
Table 2-9. Parameters
Data direction Parameter name Description
[in] lun LUN number
Returns
Status of the LUN.
2.4.3.3. Function uhi_msc_mem_read_capacity()
Returns the capacity of the LUN.
Ctrl_status uhi_msc_mem_read_capacity(
lun,uint8_t
* u32_nb_sector)uint32_t
Table 2-10. Parameters
Data direction Parameter name Description
[in] lun LUN number
[in] u32_nb_sector Pointer to store the last sector address possible on this LUN
Returns
Status of the LUN.
2.4.3.4. Function uhi_msc_mem_read_sector_size()
Returns the sector size of the LUN.
uint8_t uhi_msc_mem_read_sector_size(
lun)uint8_t
Table 2-11. Parameters
Data direction Parameter name Description
[in] lun LUN number
Returns
Sector size (unit 512B).
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
9
2.4.3.5. Function uhi_msc_mem_wr_protect()
Checks if the LUN is write protected.
bool uhi_msc_mem_wr_protect(
lun)uint8_t
Table 2-12. Parameters
Data direction Parameter name Description
[in] lun LUN number
Returns
True, if write protected.
2.4.3.6. Function uhi_msc_mem_removal()
Checks if the device is removed.
bool uhi_msc_mem_removal( )void
Returns
Always true for USB Device.
2.4.3.7. Function uhi_msc_mem_read_10_ram()
Reads 512 bytes from the current LUN.
Ctrl_status uhi_msc_mem_read_10_ram(
addr,uint32_t
* ram)void
The LUN is selected by or function.uhi_msc_mem_test_unit_ready() uhi_msc_mem_read_capacity()
Table 2-13. Parameters
Data direction Parameter name Description
[in] addr Disk address (unit 512B)
[out] ram Pointer to store the data
Returns
Status of the LUN.
2.4.3.8. Function uhi_msc_mem_write_10_ram()
Writes 512 bytes to the current LUN.
Ctrl_status uhi_msc_mem_write_10_ram(
addr,uint32_t
* ram)const void
The LUN is selected by or function.uhi_msc_mem_test_unit_ready() uhi_msc_mem_read_capacity()
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
10
Table 2-14. Parameters
Data direction Parameter name Description
[in] addr Disk address (unit 512B)
[in] ram Pointer on the data
Returns
Status of the LUN.
2.5. Enumeration Definitions
2.5.1. Enum lun_status_t
Status of LUN.
Table 2-15. Members
Enum value Description
LUN_GOOD Success, memory ready
LUN_FAIL An error occurred
LUN_NOT_PRESENT Memory unplugged
LUN_BUSY Memory not initialized or changed
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
11
3. Quick Start Guide for USB Host Mass-Storage Module (UHI MSC)
This is the quick start guide for the with step-by-stepUSB Host Mass-Storage Module (UHI MSC)
instructions on how to configure and use the modules in a selection of use cases.
The use cases highlights several code fragments. The code fragments in the steps for setup can be
copied into a custom initialization function, while the steps for usage can be copied into, e.g., the main
application function.
3.1. Basic Use Case
In this basic use case, the "USB Host MSC (Single Class support)" module is used.
The "USB Host MSC (Multiple Classes support)" module usage is described in .Advanced Use Cases
This example do a simple physical memory access, but a file system module can be added to decode the
USB memory file system, see FatFS examples.
3.1.1. Setup Steps
As a USB host, it follows common USB host setup steps. Refer to .USB Host Basic Setup
3.1.2. Usage Steps
3.1.2.1. Example Code
Content of conf_usb_host.h:
#define USB_HOST_UHI UHI_MSC
#define UHI_MSC_CHANGE(dev, b_plug) my_callback_msc_change(dev, b_plug)
extern bool bool my_callback_msc_change(uhc_device_t* dev, b_plug);
#include "uhi_msc_mem.h" // At the end of conf_usb_host.h file
Add to application C-file:
static bool false my_flag_autorize_msc_check = ;
bool bool my_callback_msc_change(uhc_device_t* dev, b_plug)
{
(b_plug) {if
my_flag_autorize_msc_check = ;true
} {else
my_flag_autorize_msc_check = ;false
}
}
void void my_task( )
{
(!my_flag_autorize_msc_check) {if
;return
}
my_flag_autorize_msc_check = ;false
// Check all new USB disks plugged
(uint8_t lun=0; lun < uhi_msc_mem_get_lun(); lun++) {for
// Wait the end of USB disk install
(CTRL_BUSY == uhi_msc_mem_test_unit_ready(lun));while
(CTRL_GOOD != uhi_msc_mem_test_unit_ready(lun)) {if
// Removal disk not present or fail
;continue
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
12
}
// Read capacity
uint32_t max_lba;
uhi_msc_mem_read_capacity(lun, &max_lba);
}
}
3.1.2.2. Workflow
1. Ensure that conf_usb_host.h is available and contains the following configuration, which is the USB
host MSC configuration:
#define USB_HOST_UHI UHI_MSC
Note:  It defines the list of UHI supported by USB host.
#define UHI_MSC_CHANGE(dev, b_plug) my_callback_msc_change(dev, b_plug)
extern bool my_callback_msc_change(uhc_device_t* dev, bool b_plug);
Note:  This callback is called when a USB device MSC is plugged or unplugged.
2. The access of the USB memories is allowed through functions described in .API Overview
3.2. Advanced Use Cases
For more advanced use of the UHI MSC module, see the following use cases:
•Enable USB High Speed Support
•Multiple Classes Support
•Dual Roles Support
3.3. Enable USB High Speed Support
In this use case, the USB host is used to support USB high speed.
3.3.1. Setup Steps
Prior to implement this use case, be sure to have already applied the UHI module "basic use case".
3.3.2. Usage Steps
3.3.2.1. Example Code
Content of conf_usb_host.h:
#define USB_HOST_HS_SUPPORT
3.3.2.2. Workflow
1. Ensure that conf_usb_host.h is available and contains the following parameters required for a USB
device high speed (480Mbit/s):
#define USB_HOST_HS_SUPPORT
3.4. Multiple Classes Support
In this use case, the USB host is used to support several USB classes.
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
13
3.4.1. Setup Steps
Prior to implement this use case, be sure to have already applied the UHI module "basic use case".
3.4.2. Usage Steps
3.4.2.1. Example Code
Content of conf_usb_host.h:
#define USB_HOST_UHI UHI_HID_MOUSE, UHI_MSC, UHI_CDC
3.4.2.2. Workflow
1. Ensure that conf_usb_host.h is available and contains the following parameters:
#define USB_HOST_UHI UHI_HID_MOUSE, UHI_MSC, UHI_CDC
Note:  USB_HOST_UHI defines the list of UHI supported by USB host. Here, you must add all
classes that you want to support.
3.5. Dual Roles Support
In this use case, the USB host and USB device are enabled, it is the dual role.
Note:  On the Atmel boards, the switch of USB role is managed automatically by the USB stack thank to
a USB On-The-Go (OTG) connector and its USB ID pin. Refer to section "Dual roles" for further
information in the application note:
•Atmel AVR4950: ASF - USB Host Stack
3.5.1. Setup Steps
Prior to implement this use case, be sure to have already applied the UHI module "basic use case".
3.5.2. Usage Steps
3.5.2.1. Example Code
Content of conf_usb_host.h:
#define UHC_MODE_CHANGE(b_host_mode) my_callback_mode_change(b_host_mode)
extern void my_callback_mode_change(bool b_host_mode);
Add to application C-file:
void void usb_init( )
{
//udc_start();
uhc_start();
}
bool my_host_mode;
void bool my_callback_mode_change( b_host_mode)
{
my_host_mode = b_host_mode;
}
void void my_usb_task( )
{
(my_host_mode) {if
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
14
// CALL USB Host task
} {else
// CALL USB Device task
}
}
3.5.2.2. Workflow
1. In case of USB dual roles (Device and Host), the USB stack must be enabled by uhc_start()
and the udc_start() must not be called.
//udc_start();
uhc_start();
2. In dual role, to know the current USB mode, the callback to notify the mode changes can be used.
•Ensure that conf_usb_host.h contains the following parameters:
#define UHC_MODE_CHANGE(b_host_mode)
my_callback_mode_change(b_host_mode)
extern void my_callback_mode_change(bool b_host_mode);
•Ensure that application contains the following code:
bool my_host_mode;
void bool my_callback_mode_change( b_host_mode)
{
my_host_mode = b_host_mode;
}
void void my_usb_task( )
{
(my_host_mode) {if
// CALL USB Host task
} {else
// CALL USB Device task
}
}
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
15
4. Configuration File Examples
4.1. conf_usb_host.h
4.1.1. UHI MSC Single
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel
Support</a>
*/
#ifndef _CONF_USB_HOST_H_
#define _CONF_USB_HOST_H_
#include "compiler.h"
#define USB_HOST_UHI UHI_MSC
#define USB_HOST_POWER_MAX 500
// #define USB_HOST_HUB_SUPPORT
#if (UC3A3 || UC3A4)
# define USB_HOST_HS_SUPPORT
#endif
//#define UHC_MODE_CHANGE(b_host_mode) usb_host_mode_change(b_host_mode)
//#define UHC_VBUS_CHANGE(b_present) usb_host_vbus_change(b_present)
//#define UHC_VBUS_ERROR() usb_host_vbus_error()
//#define UHC_CONNECTION_EVENT(dev,b_present)
usb_host_connection_event(dev,b_present)
//#define UHC_WAKEUP_EVENT() usb_host_wakeup_event()
//#define UHC_SOF_EVENT() usb_host_sof_event()
//#define UHC_DEVICE_CONF(dev) uint8_t usb_host_device_conf(dev)
//#define UHC_ENUM_EVENT(dev,b_status) usb_host_enum_event(dev,b_status)
#define UHI_MSC_CHANGE(dev,b_plug)
#include "uhi_msc.h"
#endif // _CONF_USB_HOST_H_
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
16
4.1.2. UHI MSC Multiple (Composite)
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel
Support</a>
*/
#ifndef _CONF_USB_HOST_H_
#define _CONF_USB_HOST_H_
#include "compiler.h"
#define USB_HOST_UHI // UHI_MSC, UHI_HID_MOUSE, UHI_CDC, UHI_VENDOR
#define USB_HOST_POWER_MAX 500
// #define USB_HOST_HUB_SUPPORT
#if (UC3A3 || UC3A4)
# define USB_HOST_HS_SUPPORT
#endif
//#define UHC_MODE_CHANGE(b_host_mode) usb_host_mode_change(b_host_mode)
//#define UHC_VBUS_CHANGE(b_present) usb_host_vbus_change(b_present)
//#define UHC_VBUS_ERROR() usb_host_vbus_error()
//#define UHC_CONNECTION_EVENT(dev,b_present)
usb_host_connection_event(dev,b_present)
//#define UHC_WAKEUP_EVENT() usb_host_wakeup_event()
//#define UHC_SOF_EVENT() usb_host_sof_event()
//#define UHC_DEVICE_CONF(dev) uint8_t usb_host_device_conf(dev)
//#define UHC_ENUM_EVENT(dev,b_status) usb_host_enum_event(dev,b_status)
#define UHI_HID_MOUSE_CHANGE(dev,b_plug)
#define UHI_HID_MOUSE_EVENT_BTN_LEFT(b_state)
#define UHI_HID_MOUSE_EVENT_BTN_RIGHT(b_state)
#define UHI_HID_MOUSE_EVENT_BTN_MIDDLE(b_state)
#define UHI_HID_MOUSE_EVENT_MOUVE(x,y,scroll)
#define UHI_MSC_CHANGE(dev,b_plug)
#define UHI_CDC_CHANGE(dev,b_plug)
#define UHI_CDC_RX_NOTIFY()
#define UHI_VENDOR_CHANGE(dev, b_plug)
#define UHI_VENDOR_VID_PID_LIST {USB_VID_ATMEL,
USB_PID_ATMEL_ASF_VENDOR_CLASS}
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
17
//#include "uhi_msc.h"
//#include "uhi_hid_mouse.h"
#endif // _CONF_USB_HOST_H_
4.2. conf_clock.h
4.2.1. AT32UC3A0, AT32UC3A1, and AT32UC3B Devices (USBB)
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel
Support</a>
*/
#ifndef CONF_CLOCK_H_INCLUDED
#define CONF_CLOCK_H_INCLUDED
// ===== System Clock Source Options
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_RCSYS
#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_OSC0
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_PLL0
// ===== PLL0 Options
//#define CONFIG_PLL0_SOURCE PLL_SRC_OSC0
//#define CONFIG_PLL0_SOURCE PLL_SRC_OSC1
//#define CONFIG_PLL0_MUL 4 /* Fpll = (Fclk * PLL_mul) / PLL_div */
//#define CONFIG_PLL0_DIV 1 /* Fpll = (Fclk * PLL_mul) / PLL_div */
// ===== PLL1 Options
#define CONFIG_PLL1_SOURCE PLL_SRC_OSC0
//#define CONFIG_PLL1_SOURCE PLL_SRC_OSC1
#define CONFIG_PLL1_MUL 8 /* Fpll = (Fclk * PLL_mul) / PLL_div */
#define CONFIG_PLL1_DIV 2 /* Fpll = (Fclk * PLL_mul) / PLL_div */
// ===== System Clock Bus Division Options
//#define CONFIG_SYSCLK_CPU_DIV 0 /* Fcpu = Fsys/(2 ^ CPU_div) */
//#define CONFIG_SYSCLK_PBA_DIV 0 /* Fpba = Fsys/(2 ^ PBA_div) */
//#define CONFIG_SYSCLK_PBB_DIV 0 /* Fpbb = Fsys/(2 ^ PBB_div) */
// ===== Peripheral Clock Management Options
//#define CONFIG_SYSCLK_INIT_CPUMASK ((1 << SYSCLK_SYSTIMER) | (1 << SYSCLK_OCD))
//#define CONFIG_SYSCLK_INIT_PBAMASK (1 << SYSCLK_USART0)
//#define CONFIG_SYSCLK_INIT_PBBMASK (1 << SYSCLK_HMATRIX)
//#define CONFIG_SYSCLK_INIT_HSBMASK (1 << SYSCLK_MDMA_HSB)
// ===== USB Clock Source Options
//#define CONFIG_USBCLK_SOURCE USBCLK_SRC_OSC0
//#define CONFIG_USBCLK_SOURCE USBCLK_SRC_PLL0
#define CONFIG_USBCLK_SOURCE USBCLK_SRC_PLL1
#define CONFIG_USBCLK_DIV 1 /* Fusb = Fsys/(2 ^ USB_div) */
#endif /* CONF_CLOCK_H_INCLUDED */
4.2.2. AT32UC3A3 and AT32UC3A4 Devices (USBB with High Speed Support)
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel
Atmel AT09339: USB Host Interface (UHI) for Mass Storage Class (MSC) [APPLICATION NOTE]
Atmel-42344B-USB-Host-Interface-UHI-for-Mass-Storage-Class-MSC_AT09339_Application Note-12/2015
18


Product specificaties

Merk: Microchip
Categorie: Niet gecategoriseerd
Model: ATSAMD20J18

Heb je hulp nodig?

Als je hulp nodig hebt met Microchip ATSAMD20J18 stel dan hieronder een vraag en andere gebruikers zullen je antwoorden




Handleiding Niet gecategoriseerd Microchip

Handleiding Niet gecategoriseerd

Nieuwste handleidingen voor Niet gecategoriseerd