From 14083ad2df1252436d9f563fb5cf357052a7ec3c Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Sat, 27 Feb 2021 16:59:50 +0700 Subject: Update getting_started.md --- docs/getting_started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/getting_started.md') diff --git a/docs/getting_started.md b/docs/getting_started.md index 06dcbd136..dfdf02562 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -10,9 +10,9 @@ It is relatively simple to incorporate tinyusb to your (existing) project - Make sure all required macros are all defined properly in tusb_config.h (configure file in demo application is sufficient, but you need to add a few more such as CFG_TUSB_MCU, CFG_TUSB_OS since they are passed by IDE/compiler to maintain a unique configure for all boards). - If you use the device stack, make sure you have created/modified usb descriptors for your own need. Ultimately you need to implement all **tud_descriptor_** callbacks for the stack to work. - Add tusb_init() call to your reset initialization code. -- Call `tud_int_handler()` (device stack) and/or `tuh_int_handler()` in your USB IRQ Handler +- Call `tud_int_handler()` (device) and/or `tuh_int_handler()` (host) in your USB IRQ Handler - Implement all enabled classes's callbacks. -- If you don't use any RTOSes at all, you need to continuously and/or periodically call tud_task()/tuh_task() function. All of the callbacks and functionality are handled and invoke within the call of that task runner. +- If you don't use any RTOSes at all, you need to continuously and/or periodically call tud_task()/tuh_task() function. All of the callbacks and functionality are handled and invoked within the call of that task runner. ~~~{.c} int main(void) -- cgit v1.3.1 From 7afaae7ffc71094363a54dc92ab7982d0cb84d7b Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 2 Mar 2021 10:18:44 +0700 Subject: remove submodule lib/CMSIS_5 --- .github/workflows/build.yml | 2 +- .gitmodules | 3 --- docs/getting_started.md | 6 +++--- lib/CMSIS_5 | 1 - 4 files changed, 4 insertions(+), 8 deletions(-) delete mode 160000 lib/CMSIS_5 (limited to 'docs/getting_started.md') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b63a9a031..f90a6843d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,7 +65,7 @@ jobs: submodules: 'false' - name: Checkout Submodules in lib - run: git submodule update --init --recursive lib + run: git submodule update --init lib - name: Build run: python3 tools/build_family.py ${{ matrix.family }} diff --git a/.gitmodules b/.gitmodules index 209b6ea95..664e32c59 100644 --- a/.gitmodules +++ b/.gitmodules @@ -100,9 +100,6 @@ [submodule "hw/mcu/st/stm32l5xx_hal_driver"] path = hw/mcu/st/stm32l5xx_hal_driver url = https://github.com/STMicroelectronics/stm32l5xx_hal_driver.git -[submodule "lib/CMSIS_5"] - path = lib/CMSIS_5 - url = https://github.com/ARM-software/CMSIS_5.git [submodule "lib/sct_neopixel"] path = lib/sct_neopixel url = https://github.com/gsteiert/sct_neopixel diff --git a/docs/getting_started.md b/docs/getting_started.md index dfdf02562..870491fe2 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -39,13 +39,13 @@ $ git clone https://github.com/hathach/tinyusb tinyusb $ cd tinyusb ``` -TinyUSB examples includes external repos aka submodules to provide low-level MCU peripheral's driver as well as external libraries such as FreeRTOS to compile with. Therefore we will firstly fetch those mcu driver repo by running this command in the top folder repo +Some TinyUSB examples also requires external submodule libraries in `/lib` such as FreeRTOS, Lightweight IP to build. Run following command to fetch them ``` -$ git submodule update --init --recursive +$ git submodule update --init lib ``` -It will takes a bit of time due to the number of supported MCUs, luckily we only need to do this once. Or if you only want to test with a specific mcu, you could only fetch its driver submodule. +In addition, MCU driver submodule is also needed to provide low-level MCU peripheral's driver. Luckily, it will be fetched if needed when you run the `make` to build your board. ### Build diff --git a/lib/CMSIS_5 b/lib/CMSIS_5 deleted file mode 160000 index b7b26f50d..000000000 --- a/lib/CMSIS_5 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b7b26f50d00072812aec8453f643e24bafedccb5 -- cgit v1.3.1 From 4a73b6a21930c71368153fe4197b96f9d100fc4c Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 10 Mar 2021 11:23:44 +0700 Subject: update doc for BOARD name, add note for udev on Linux --- docs/getting_started.md | 4 ++++ examples/device/99-tinyusb.rules | 14 ++++++++++++++ examples/device/webusb_serial/src/main.c | 20 ++++++++++++++++++++ tools/usb_drivers/99-tinyusb.rules | 18 ------------------ 4 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 examples/device/99-tinyusb.rules delete mode 100644 tools/usb_drivers/99-tinyusb.rules (limited to 'docs/getting_started.md') diff --git a/docs/getting_started.md b/docs/getting_started.md index 870491fe2..8ec0ea748 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -47,6 +47,8 @@ $ git submodule update --init lib In addition, MCU driver submodule is also needed to provide low-level MCU peripheral's driver. Luckily, it will be fetched if needed when you run the `make` to build your board. +Note: some examples especially those that uses Vendor class (e.g webUSB) may requires udev permission on Linux (and/or macOS) to access usb device. It depends on your OS distro, typically copy `/examples/device/99-tinyusb.rules` file to /etc/udev/rules.d/ then run `sudo udevadm control --reload-rules && sudo udevadm trigger` is good enough. + ### Build To build example, first change directory to an example folder. @@ -61,6 +63,8 @@ Then compile with `make BOARD=[board_name] all`, for example $ make BOARD=feather_nrf52840_express all ``` +Note: `BOARD` can be found as directory name in `hw/bsp`, either in its family/boards or directly under bsp (no family). + #### Port Selection If a board has several ports, one port is chosen by default in the individual board.mk file. Use option `PORT=x` To choose another port. For example to select the HS port of a STM32F746Disco board, use: diff --git a/examples/device/99-tinyusb.rules b/examples/device/99-tinyusb.rules new file mode 100644 index 000000000..e6372ed58 --- /dev/null +++ b/examples/device/99-tinyusb.rules @@ -0,0 +1,14 @@ +# Copy this file to the location of your distribution's udev rules, for example on Ubuntu: +# sudo cp 99-tinyusb.rules /etc/udev/rules.d/ +# Then reload udev configuration by executing: +# sudo udevadm control --reload-rules +# sudo udevadm trigger + +# Check SUBSYSTEM +SUBSYSTEMS=="hidraw", KERNEL=="hidraw*", MODE="0666", GROUP="dialout" + +# Rule applies to all TinyUSB example +ATTRS{idVendor}=="cafe", MODE="0666", GROUP="dialout" + +# Rule to blacklist TinyUSB example from being manipulated by ModemManager. +SUBSYSTEMS=="usb", ATTRS{idVendor}=="cafe", ENV{ID_MM_DEVICE_IGNORE}="1" diff --git a/examples/device/webusb_serial/src/main.c b/examples/device/webusb_serial/src/main.c index 143a73374..6a5a9fa61 100644 --- a/examples/device/webusb_serial/src/main.c +++ b/examples/device/webusb_serial/src/main.c @@ -23,6 +23,26 @@ * */ +/* This example demonstrates WebUSB as web serial with browser with WebUSB support (e.g Chrome). + * After enumerated successfully, browser will pop-up notification + * with URL to landing page, click on it to test + * - Click "Connect" and select device, When connected the on-board LED will litted up. + * - Any charters received from either webusb/Serial will be echo back to webusb and Serial + * + * Note: + * - The WebUSB landing page notification is currently disabled in Chrome + * on Windows due to Chromium issue 656702 (https://crbug.com/656702). You have to + * go to landing page (below) to test + * + * - On Windows 7 and prior: You need to use Zadig tool to manually bind the + * WebUSB interface with the WinUSB driver for Chrome to access. From windows 8 and 10, this + * is done automatically by firmware. + * + * - On Linux/macOS, udev permission may need to be updated by + * - copying '/examples/device/99-tinyusb.rules' file to /etc/udev/rules.d/ then + * - run 'sudo udevadm control --reload-rules && sudo udevadm trigger' + */ + #include #include #include diff --git a/tools/usb_drivers/99-tinyusb.rules b/tools/usb_drivers/99-tinyusb.rules deleted file mode 100644 index 334159f9a..000000000 --- a/tools/usb_drivers/99-tinyusb.rules +++ /dev/null @@ -1,18 +0,0 @@ -# Copy this file to the location of your distribution's udev rules, for example on Ubuntu: -# sudo cp 99-tinyusb.rules /etc/udev/rules.d/ -# Then reload udev configuration by executing: -# sudo udevadm control --reload-rules -# sudo udevadm trigger - -# Check SUBSYSTEM -SUBSYSTEMS=="hidraw", KERNEL=="hidraw*", MODE="0666", GROUP="dialout" - -# Rule applies to all TinyUSB example -ATTRS{idVendor}=="cafe", MODE="0666", GROUP="dialout" - -# Rule to blacklist TinyUSB example from being manipulated by ModemManager. -SUBSYSTEMS=="usb", ATTRS{idVendor}=="cafe", ENV{ID_MM_DEVICE_IGNORE}="1" - -# Xplained Pro SamG55 Device -SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2111", MODE="0666", GROUP="users", ENV{ID_MM_DEVICE_IGNORE}="1" -SUBSYSTEMS=="tty", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2111", MODE="0666", GROUP="users", ENV{ID_MM_DEVICE_IGNORE}="1" -- cgit v1.3.1