|
|
View previous topic :: View next topic |
Author |
Message |
Picmicro_man
Joined: 01 Jan 2022 Posts: 13
|
Microcontroller as a USB host |
Posted: Tue Feb 14, 2023 1:14 am |
|
|
Hi Guys
I want to work on USB which I never worked before. I want my microcontroller to works as a USB Host.
There are two ways
1- One microcontroller which have USB host firmware and all other functions which I want to perform like update the LCD, reading data from IO ports etc
2- There will be Two microcontrollers One perform other tasks like LCD update etc and Other microcontroller have USB Host firmware which connects the external USB slave devices. These two microcontrollers will exchange data using UART port.
Kindly guide me how do I start this and what resources are available to understand and write some code for these scenario.
Thanks in advance |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Tue Feb 14, 2023 2:30 am |
|
|
Seriously, 'ouch'.
A USB host is terrifyingly complex. Do not look at trying to do this, except
on the larger PIC's. It needs a lot of code space.
95% of USB PIC's do not have the hardware to implement a 'host'. The
key about USB, is the slave is designed to be relatively simple (both in
hardware and software), but this comes at the expense of making the
'host' more complex. Only PIC's with 'USB OTG' peripherals have the
hardware.
Now CCS do not supply host firmware. You have to use the MicroChip
versions, with some tweaking. A lot of work. Understand that a USB host
is not a 'single job', it has to provide a USB 'stack' to control the attached
device(s). The easiest way to provide a 'host' (and I have found it many
hundreds of times more reliable than the MicroChip stack), is instead to
use a Vinculum as the host. This can be driven using UART serial or with
SPI, and it is possible to have a host working with only a few hours of
programming.
Every time I have tried to use the MicroChip USB host firmware on a
PIC, I have found it to be unreliable, when running for a long time.
However I was doing this a couple of years ago on PIC18's. I have since
seen reasonably reliable host implementations on the PIC, but all seem
to be based on PIC24/32's, and more recent code. I tried with both
modified code compiled with CCS, and stuff compiled with MPLAB XC.
Both gave the same problems. Also tried using MicroChip's own prototype
board, in case it was a hardware issue. Still the same. All would work
fine for a few days, but not if you wanted something to work reliably for
weeks. Now at the time I think I was using stack 1.3, then 2.1. I think
they are now up to 2.6A, so things may well have improved.
So, if you have a lot of time, go with your PIC solution, but definately
look at using a PIC24 or 32. If not, consider using the Vinculum.
The PIC24FJ64GB002, seems to be a chip that now shows good reliability
on the MicroChip USB host implementation.
You understand, that to connect multiple devices, you would need to use
a hub?. Most PIC's (all PIC18's?), do not support hubs. PRE token
generation (needed when there are mixed speeds on devices attached
to a hub), was a feature that was very buggy. |
|
|
Picmicro_man
Joined: 01 Jan 2022 Posts: 13
|
|
Posted: Tue Feb 14, 2023 6:17 am |
|
|
Thanks Ttelmah for your detailed description.
I was also looking for FTDI Vinculum chip as you mentioned, Also I checked their website there are some firmware available as a sample.
As I am new to USB I am confused which platform to choose, so I think Vinculum is the platform to choose for USB development.
Can you tell me any great link which describes USB protocols/drivers in details so that I can understand this and write the code for this
Thanks and best regards |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Tue Feb 14, 2023 6:46 am |
|
|
Years ago I got the Vinculum-2 (?),has 2 ports, one can be 'host', the other 'device'(flash drive) connected to a PIC18F46K22. Spent a month trying to get it 'up and running' but client's projects needed to get finished.
Kinda scary how much time has passed since then..
I know I prefer real comports to USB. Since I'm a 'dinosaur' ,I used to cut low level interrupt driven serial interfaces in very tight, short code.
It'd be interesting to see how large a program would have to be, to echo 'Hello World' from a PC. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|