Writing to Host n SOF/EOP Count Registers when using a hub

Question: When I connect a second device (also full speed) to port 2 (same SIE). When this port comes out of reset it affects the timing of the SOF packets being sent. Is there a fix for this? When I have a Hub on on port of an SIE and connect a device on the second port of the same SIE the hub stops working. what can be the issue?

 

Answer:

The Host n SOF/EOP Count Register (0xC092 and 0xC0B2) contains the SOF/EOP count value that is loaded into the SOF/EOP counter. This value is loaded each time the SOF/EOP counter counts down to zero. This default value set in this register at power up is 0x2EE0, which will generate a 1 ms timer frame. The SOF/EOP counter is a down counter decremented at a 12-MHz rate. When Host n SOF/EOP Count Register (0xC092 and 0xC0B2) gets written, the SOF/EOP generator will be reset and the frame length will be changed. In EZ-Host two ports share one SIE (PortA and PortB share SIE1). Suppose the PortA is connected to a hub ( they are working) while a device is inserted to PortB. The host software may want to write a value to Host n SOF/EOP Count Register (0xC092). Then the SOF/EOP generator will be reset and the frame length will be changed. This will likely cause the hub stop working. The reason is:

Although the hub is synchronized to the SOF, timing skew can accumulate between the host and a hub. The total accumulated skew can be as large as ?9 bit times. Beyond that the hub may stop working.

So when sharing an SIE for two host ports, Host n SOF/EOP Count Register (0xC092 and 0xC0B2) for this SIE shouldn't be written when a new device is inserted. The default value (0x2EE0) will be used in this case. If you are using the ISR HUSB_RESET when you get an insert, the HUSB_RESET will write to this register and can cause the problem.

The corrective action for this issue is to NOT write to the "Host n SOF/EOP Count Register" when you have a hub on that SIE - or at all for that matter. Leave the value as the default 0x2EE0. If you need to call the USB Reset function in the BIOS, then you may need to write your own USB Reset handling routine based on our BIOS code, but removing the write of the Host n SOF/EOP Count Register.