I have a task where i need to implement L2 Suspend state in Link Power Management. I use a development board where it has DWC3 usb controller interfaced with PHY. Basically our board uses Linux usb DWC3 driver and connected to Host.
My understanding is USB controller generates SUSPEND signal after bus inactivity of 3.125 msec.
Can anyone tell me how can i configure this controller to implement L2 suspend state?
In your current setup, your board is in device/gadget mode and you are connected to host.
Remember that USB device can not drive suspend signalling. It is supposed to be started by Host.
The process of suspend for USB 2.0 device -
1 - USB host has no data to send and currently its sending SOF frames
2 - Host SW suspends the device by setting suspend/U3 in EHCI/XHCI controller
3 - Now the USB device sees idle state in the bus where there is no SOF
4 - After approx 3 ms, the device hardware starts to suspend itself by removing its termination to the ground and connecting the internal pull up register
5 - Then the device again poll the lines to see whether the host has removed its termination or not.
6 - Since host has removed the termination, the device will go to suspend
Process of suspend for USB 3.0 device -
1 - USB host has no data to send
2 - Host SW suspends the device by setting U3 in XHCI controller
3 - Host starts sending LGO_U3 link commands to initiate the suspend signalling
4 - After device receives LGO_U3 command, it will acknowledge and start suspend
So in conclusion, from USB device you can not start the suspend signalling. You can only set the internal state of the device stack.
EDIT 1 - This process of suspend is for USB 2.0 / High speed devices. If your board is a super speed/ USB 3.0 device connected via SS port to the host, then the process is a little different in link level, but from user point of view there is no difference.
EDIT 2 - I have now updated the answer with suspend process for USB 2.0 and USb 3.0 devices
Related
I've problems with a MODBUS RTU connection to devices after a disconnect & reconnect of the RS232. The system is build up the following way:
MODBUS RTU device with A+ & B- clamps (no C = GND available, e.g. electricity meter SDM120, but problem also appears on other device types)
RS485 wires A & B
Adapter RS232 -> RS485 DA-70161 based on SP485EE chip
RS232 cable with DSUB9 connector
UART connected MAX3243 chip for RS232 with CTS/RTS
libmodbus software using /dev/ttymxc0 configured for 9600baud 8N1 (fitting to device defaults)
Linux kernel 4.4.0 embedded ARM CPU
In general this works fine, even over weeks. But once one disconnects the RS232 cable and reconnects it after some seconds (or minutes or hours), the libmodbus gets timeout-errors on every access to the MODBUS device.
This is very annoying, because it is difficult to get it back to work again. Only a lot of further disconnects of both ends of the RS232-RS485-Adapter will bring it back, after some minutes and up to 10 retries.
Any idea what could cause this problem?
Any help what to do to prevent this and immediately work after reconnect the RS232 cable?
(Yes, one possible solution is to simply let the RS232 cable be always connected. But sometime somebody need to do something and forgot about the consequences - I think this is not a realistic option)
I've got an solution, with help of mikrocontroller.net forum:
Using another RS232 → RS485 adapter DeLock 62919 and powering with +5V on the clamps by dedicated power-supply, did the job!
Now the communication comes up again, even after RS232 was un- and replugged
A method to Connect / Disconnect a USB device "softly".
Hey, Assume I have a USB device connected to my PC, I want to enable/disable the port it is connected via computer so that I don't have to unplug/plug my device each time.
P.S : Device is a Microcontroller Board ( powered by USB port ) , so I don't want it to be active all the time. I want to deactivate it when appyling changes to code etc. and then activate that port so I can load my code into it again.
Is there a method to do so ?
Thanks in advance.
Device is a Microcontroller Board ( powered by USB port )
Most USB enabled µC types can "unplug" themself.
The idea is to put the USB data pins (usually called D+ and D-) into "output low" state for about one second at startup. This forces USB to be recognized as "disconnected".
After that is done, re-configure the pins to for their USB function and initialze the USB as usual.
Note that this method is not possible on old style boards that still use USB2UART chips instead of hardware USB inside the µC itself.
I want to create a Linux network driver for a FS1000A connected to the RasPI via GPIO. It does not need to support a high bitrate.
The hardware is already working, I've previously managed to emulate a 433 MHz remote control using a FS1000A transmitter connected to a Raspberry PI's GPIO pins. The FS1000A transmitter and receiver use on off keying. If the GPIO pin is set high, the transmitter transmits a carrier. If it's set low it does not transmit.
According to an article about writing virtual interfaces, "A virtual interface has no way to receive interrupts, and thus it cannot receive any network packet." Is it possible to receive an interrupt when a GPIO pin changes state on a Raspberry PI? If not it is possible for a network driver to get a callback to poll the state of a GPIO pin? It does not have to be elegant or efficient, it just needs to work.
Does a network driver's xmit function have to block until all the data is sent? That could take a long time the packet is transmitted 9600 bps.
I read a guide to writing network device drivers for Linux but it is focused on PCI devices. Is there any documentation/tutorials about writing network drivers for Linux?
Any other tips suggestions welcome.
Bluefruit EZ-link is described as programmer. It means it supports RTS/DTR:
The EZ-Link has another impressive feature: the DTR/RTS/DSR flow
control pins are automatically synced to the computer serial port.
What this means is that if the computer sets the hardware flow control
DTR or RTS pins high or low the pins on the bluetooth module will
follow.
So Arduino IDE performs reset to initiate flashing (as Arduino's Bootloader wait for few seconds after reset for upload commands from Arduino IDE). For USB reset works by switching DTR to 1 and 0 and special schematics on Arduino board monitors it and performs reset. After reset is done Arduino IDE runs avrdude and start flashing.
The question is "How does it works over Bluetooth module by Adafruit?" There is no RTS/DTR line for Bluetooth..
PS. I believe virtual COM-port drivers for this Bluetooth device should send special AT+ commands and Bluetooth device should handle them and perform setting 1 or 0 to special pin wired with MCUs reset. But this requires Bluefruit bluetooth driver to be used. But i can't see it requires special BT drivers at computer.
RFCOMM do support flow control.
RFCOMM is based on GSM TS 07.10. Bluefruit extract info on RFCOMM and map it to flow control lines.
Can we know the bdaddress and rssi of all nearby ble devices without continuous lescanning? As the continuous lescan will consume more power and also we would not be able to properly make connection to a device while active scanning is going on in background.
The lescan background process also gets killed when we are disconnected from the connected state with any ble device
Also with how many peripherals can a central device be connected to simultanoeusly with bluez-4.101 stack?
Yes you are right you cannot make connection while you are scanning for Low Energy devices and number of devices that can be connected to the central device is entirely dependent on the Software Stack you are using for BLE.
Like in CC2540 you can connect 3 devices at a time.
For RSSI and bluetooth address you refer function le_advertising_report according to bluez-4.101 stack.