The environment is only provided as example and as a base for the samples. You have to implement the functions declared in include/uspios.h in your system and provide them to the USPi library. Most systems have own functions for memory allocation, interrupt handling etc. and you have to provide a wrapper to them.ydk wrote:I am finding it difficult to get it compiled because USPi uses the built in environment which initializes the raspberry pi system (like timers, interrupts, etc) and there are many function calls in USPi source which use this environment setup e.g. (SetPowerStateOn(), ConnectInterrupt() etc).
I tested the USPi library with the provided environment only but I know that other people use the library with their own system.By any chance have you ported USPi to any standard rtos like freertos or other?
You cannot. This is not implemented in USPi. USB devices have to be already connected on boot and must not be removed while the system is running. The comments were for testing only.tarkshya wrote:Any idea how we can figure out when a device is connected or disconnected.
There is a host port register which has bits for connect and disconnect. You can enable an interrupt if a status change on this port occurs. This only works on the models A, A+ or Pi Zero. When a hub is connected to the root port the connect/disconnect events are handled by the hub driver. There is an interrupt endpoint which has to poll the hub continuously for status changes.tarkshya wrote:Hello rst, any idea, how the linux driver subsystem allows it? like USB hotplugging, is it a timer based approach or interrupt driven ?
With USPi there should only be USB interrupts if there is some device attached which has an interrupt endpoint (e.g. keyboard, mouse). It is simply polled for events.Also i am seeing a lot of interrupts, even when the system is not doing anything
I think this is still the case with Raspbian on the RPi 1 and Zero. RPi 2 and 3 have more hardware support to avoid this. USPi has a different approach for the "micro-frame scheduler" which doesn't use that much interrupts but may disable the IRQ for longer if low- or full-speed devices are attached.which mentions 8000 interrupts/sec (that happens to be that USB 2.0 125 ms frame thing).
Getting rid of hotplugging was a design decision to reduce complexity also in USPi.The xinu os which has a simpler and clean implementation (for this synopsys controller) neither seems to implement hotplugging nor the interrupt reduction thing.
For hotplugging it may be the best reference. I'm not sure if Ultibo supports hotplugging.Any idea on how to approach both these problems (or i have to read the entire linux usb driver before attempting anything) ?
Not by myself. But of course you can!can't we attempt something like that in USPI?
Yes, Ultibo core does support hotplugging (connect / disconnect) for all USB devices.rst wrote:I'm not sure if Ultibo supports hotplugging.
Thanks! Unfortunately there isn't GPIO (and FIQ) support in USPi. The function of the USPi environment was reduced to the features needed to get the USB support running. Other features have to be implemented by yourself.vtrucco wrote:Hey rst, great work, thanks for sharing.
Already did some tests and works great, but I can´t figured out how to configure a FIQ (I need to listen for a falling edge in GPIO24).
My hardware is already working in my bare metal app, but I would like to include mouse support.
Normally the GNU C++ compiler is able to build C code too.quarkjuggler wrote:I clicked on an item and got the message "The following problems were found during validation of compiler set "TDM-GCC 4.9.2 32-bit Release". The following libraries don't exist: C:\Program Files\Dev-Cpp\MinGW64\lib32 <CR><LF>Would you like Dev-C++ to remove them...? ....
Can I use a C++ compiler to compile a C program like yours? Should I be trying to compile the top level, which I assume is "USBDevice"?
No, the USPi library implements an USB host controller interface driver with some function drivers for specific USB devices. It cannot be used to let the Pi Zero act as an USB device on another USB host controller.EyeJay wrote:Does the library implement a USB CDC serial interface? I would like the Pi to appear as a virtual serial port when connected via the USB port.
Have a look at this. I don't know if this is still up-to-date.If not, would you be able to point me in the right direction?