2 SOF detection in 1ms
Posted: Thu Jun 30, 2011 5:50 pm
Using an USB_SOF_HOOK macro (only one instruction: sbi PINB,1 ) in order to toggle PB1 for testing SOF detection, instead of getting a square wave signal on output pin 1, a narrow pulse appears in every 1 ms. The pulse width is less then 100us. Actually it is around 5us.
Can the USB driver of the device detect 2 SOF instead of 1 in every 1ms? How can I eliminate it?
During a data exchange between host and device the PB1 pulse polarity changes several times, but between two data exchange the polarity is stable. It seems to have a second SOF detected following by 100us the first one, but some times only a single SOF is detected.
The PB1 signal sequence looks like:
1ms rate: ........|......|......|......|.......|......|.......|....
PB1 output: L...LHL...LHL...LHL...LHH...HLH...HLL...LHL...
The expected PB1 sequence would be:
PB1 output: L...LHH...HLL...LHH...HLL...LHH...HLL...LHH...
(I am using a HID application based on ATtiny45. The USB D- and D+ lines are connected to PB3 and PB4 respectively. The application uses PB0 and PB2 as input, PB1 as output, PB5 as reset. Only pin change interrupt on D- is used. The HOST exchanges data with the device in every 400ms.
The main parameter setings:
#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0
#define USB_CFG_EP3_NUMBER 3
#define USB_CFG_SUPPRESS_INTR_CODE 0
#define USB_CFG_INTR_POLL_INTERVAL 10
#define USB_CFG_IMPLEMENT_FN_WRITE 1
#define USB_CFG_IMPLEMENT_FN_READ 1
)
Can the USB driver of the device detect 2 SOF instead of 1 in every 1ms? How can I eliminate it?
During a data exchange between host and device the PB1 pulse polarity changes several times, but between two data exchange the polarity is stable. It seems to have a second SOF detected following by 100us the first one, but some times only a single SOF is detected.
The PB1 signal sequence looks like:
1ms rate: ........|......|......|......|.......|......|.......|....
PB1 output: L...LHL...LHL...LHL...LHH...HLH...HLL...LHL...
The expected PB1 sequence would be:
PB1 output: L...LHH...HLL...LHH...HLL...LHH...HLL...LHH...
(I am using a HID application based on ATtiny45. The USB D- and D+ lines are connected to PB3 and PB4 respectively. The application uses PB0 and PB2 as input, PB1 as output, PB5 as reset. Only pin change interrupt on D- is used. The HOST exchanges data with the device in every 400ms.
The main parameter setings:
#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0
#define USB_CFG_EP3_NUMBER 3
#define USB_CFG_SUPPRESS_INTR_CODE 0
#define USB_CFG_INTR_POLL_INTERVAL 10
#define USB_CFG_IMPLEMENT_FN_WRITE 1
#define USB_CFG_IMPLEMENT_FN_READ 1
)