|
(2004.03.23 renewals) |
|
(2004.03.24 renewals) |
|
(2005.08.25 renewals) |
With in the first place IgorPlug-USB the device controller is actualized with the software of AVR. About the host controller without being able to make simply, how it does? We would like to answer with the spot goods, with vis-a-vis questioning which is said to your own.
First power it mounts weakly with C8051F310
Furthermore there are
times fine control built-in clock frequency as the merit which uses
C8051F310. When with software UART and the like severe timing is necessary,
you describe with the assembler and count the number of states and of
adjusting timing with such as nop the method is taken. Without applying that
kind of time, while writing the cord/code of signal output suitably in C
language, measuring the period of the output ripple mark with [rojiana] by
the fact that you adjust the specification to the frequency adjustment
register, it reached the point where simply the signal of 1.5Mbps can be
output. This is easily.
By the way the circuit is OK by only the tip/chip and resistance. Perhaps, the USB connected part with also only the pull-down of 15Kohm is good, but because of sense following to the USB specification, the resistance of 33ohm is being inserted. In addition LED 2 is connected for operation verification.
You understand USB protocol
Next is mounting the software. You read also the specification and the USB finished product which is http://66.249.93.104/translate_c?hl=fr&ie=UTF-8&oe=UTF-8&langpair=ja%7Cen&u=http://www.usb.org/developers/docs&prev=/language_tools, but the fact that it is easiest to understand was special edition of the [tora] skill 2000 June edition “the original USB adapter which is made”. The protocol of USB is trained with these descriptions as a reference.
First 1ms period is necessary. With Low Speed both D+/D- End of Packet which is made 0 is output at 1ms period. Unless there is this, the device does Sleep. It is the entire flow next, but when connection of the device is verified, it outputs Reset, [eniyumereshiyon] after doing, it becomes the flow that at fixed period interrupt transfer is done.
It is something where [eniyumereshiyon] whether some kind of device is connected acquires information in order to know, sets the device on the basis of that information. It understood but that type of device which is connected is made fixed, if was, as for necessary processing with just Set Configuration is OK. This time combining also the test, it tried mounting Get Descriptor and Set Address and Set Configuration.
You understand that you can look at the source, but in order to be able to output the packet which is appointed basically, it forms the differential output data on RAM, collects that and outputs with 1.5Mbps. When it outputs, when the I/O port is set to input directly and the input data changes, data reception is started. After that it is to have the necessity to output ACK, but because answering time was not done operation lately normally, that here it tries to develop in RAM the differential data of the ROM table is output to the I/O port directly. If more Sawayama there is a RAM capacity of the IDATA territory whose fast access is possible it is to be good but.
It tries being able to connect the USB mouse
Connecting the
actually Low Speed device, it tries receiving the data. First it tries being
able to connect the stock [rojikuru] USB mouse. In order to be able to
verify operation, it tried making state of the left and right button of the
mouse LED INDICATE.
Temporarily, connecting directly the Low Speed device which is purpose of beginning to the micro-computer, it could actualize the fact that it communicates. But the for the sake of or live wire 挿 removal which has not understood the I/O setting of C8051F310 well was not possible, struck to the dark aspect of clock rise and/or with in your own mark ended in the unsatisfactory result. Because with the Low Speed corresponding USB host as for the minimum it should doing you understood, using the AVR micro-computer, the next we would like to mount those which it can be satisfied.
There is no with something and arranged the order of AVR and counted the number of Cycles. Although the data which is placed on RAM is consecutively output to Port as for being necessary if 8Cycle it is even with the data on 6Cycle and ROM, it understood that it can output. If even with AVR 12MHz using AVR in the same way as IgorPlug-USB with the notion that where sending and receiving is produced the signal of 1.5Mbps extremely simply, it tries challenging in micro-computer direct connection.
It tried
making the USB directly connected circuit promptly. At the beginning that it
is to think whether it will try using even with ATtiny26L, but thinking of
that the external oscillator is necessary after all popular we had decided
to use AT90S2313. After all this time we had decided to borrow the power of
clock rise.
Because setting of the Port register is easy to understand the USB device could AVR verify taking out and putting in with change of the PIND register whether. Now with C8051F310 it is possible to correspond to the live wire 挿 removal which cannot be actualized.
First operation is verified with the USB mouse
With C8051F310, forming the transmission serial data in the program, it made output. This time opening being, it has the transmission serial data with the ROM table, without thinking at all, it tried doing to the thing which is made to output. In a manner of speaking what operation of CRC makes output at all fixed values as a serial data player. Degree of freedom was gone, but the program itself became simple ones very.
In addition when with
C8051F310 it waited for the connection of the USB device after Reset of the
micro-computer itself and connection was verified, we did Reset and
[eniyumereshiyon] of the USB bus, but this time USB device connection/give
two states of no connection, the occasion where it moves to engagement from
no connection state it made USB bus Reset and to do [eniyumereshiyon]. Now
it reached the point where it can do live wire 挿 removal.
First using the USB mouse, it did operation verification. When C8051F310 similarly, the left and right button is pushed, LED that it tries trying shines. Now it could actualize the [ikasama] USB host environment whose cheapness procurement characteristic is high with the DIP package.
The USB game pad conversion adapter is actualized
As a Low Speed USB device other than the mouse, the USB keyboard and the USB game pad come to mind. It tries making those which convert button state of the USB game pad to the Port output of AVR as an applied example of the [ikasama] USB host.
It is the same as the USB mouse in regard to [eniyumereshiyon] of the USB game pad. When address is set with Set Address and Set Configuration is done in Config number 1st fixing, the data reception with Interrupt transfer becomes possible. It understood that the data string which with ASCII PROPELLANT-ACTUATED DEVICE USB mini when you verify, SYNC/DATA/0x01/left and right/the top and bottom/the button/with said the format of the reception data is returned. Left and right and the top and bottom state of the button is returned at value of 3 types of 0x00/0x80/0xFF. In addition the data is transmitted when the button becomes ON and when becoming OFF.
It is difficult for 5V power source to be necessary, different from the joystick of ATARI specification, but it was possible to convert button information of the USB game pad which is sold temporarily in there to the Port output of AVR. Rather than calling the USB host, as the conversion adapter perhaps you can use.
Radio remote control is actualized easily with the radio USB mouse
It reached the point
where it can procure also the radio USB mouse recently cheaply. When this is
controlled with the [ikasama] USB host, that you thought whether it is not
to be able to make radio remote control easily. It is to think if at the
beginning being the same as the wire USB mouse, you put, that it moves, but
C8051/AVR which with the firmware it made it could not use the stock radio
USB mouse to that.
Two there was a problematical point of the former firmware. One when NAK is returned vis-a-vis Set Address and Set Configuration, is the point which does not have retransmission processing. Because with the USB mouse and the USB game pad of [rojikuru] NAK had not returned, it is problem not to be, but with the radio USB mouse 2 NAK moths after returning, it understood that STATUS is returned. Whether NAK or DATA0/1 whether or not by the fact that bit of specific position of the reception data decides with 0 or 1, in high speed NAK when it decides, it is NAK, the processing which resends IN was added then.
One more until ACK is returned with Interrupt transfer, is time. When you look at the USB specification carefully, that 18bit it waits as a token interval at least, it is written. With to say, speaking conversely, unless ACK must be returned within 18bit, it means. This with the USB mouse and the UBS game pad more between having been less crowded, moving, it is to be, but with the radio USB mouse trouble occurred.
It corrected the firmware, somehow used the radio USB mouse and easily could actualize radio remote control. Presently is the remote control just of 2bit of button information, but it is the mouse in the time because angle thinking of the applied example which utilizes the indication of XY displacement effectively you think as like.
Power only the SHIFT key corresponds weakly
Because the keyboard
is handled, if originally is, it is necessary to do ON/OFF and the like of
LED of correspondence of the CTRL key and correspondence and state
indication of the CAPS LOCK, but when power the SHIFT key is pushed weakly,
just processing corresponded. As for truth when it can actualize to the
level which can be used in the VT100 interchangeable serial console
substituting it is [yokatsuta], but capability did not accompany.