This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

StartWare里的USBReset求助

Other Parts Discussed in Thread: AM3352, SYSCONFIG, SYSBIOS

我自己的AM3352板子在使用AM335X_StarterWare_02_00_01_01\drivers\usb.c里面的USBReset()函数出现问题,如下:

这个是C代码

void USBReset(unsigned int ulBase) {     unsigned int reg;

    reg = HWREG(ulBase + USB_0_CTRL);     reg |= 1;

    /* Set the Reset Bit */     HWREG(ulBase + USB_0_CTRL) = reg;         

    /* Wait till Reset bit is cleared */    

    while(((HWREG(ulBase + USB_0_CTRL)) & 0x1 )== 1);

}

功能清楚明了,编译后变为

80016c94:   E59FC0CC LDR             R12, $C$CON15

80016c98:   E3A00001 MOV             R0, #1

;while(((HWREG(USBSS_BASE+USBSS_SYSCONFIG)) & 0x1 )== 1);

80016c9c:   E58C0000 STR             R0, [R12]

$C$L31:

80016ca0:   E59C1000 LDR             R1, [R12]

80016ca4:   E1B01F81 MOVS            R1, R1, LSL #31

80016ca8:   1AFFFFFC BNE             $C$L31

……………………

好像也木有什么问题,但是只要全速执行的时候

80016ca0:   E59C1000 LDR             R1, [R12]

这个句就会产生一个data abort的异常

ti.sysbios.family.arm.exc.Exception: line 176: E_dataAbort: pc = 0x80016ca0, lr = 0x80016d08. xdc.runtime.Error.raise: terminating execution

如果在C里面加入一个短延时,像这样:

HWREG(ulBase + USB_0_CTRL) = reg;     

 i=1000;  

while(i--);    

/* Wait till Reset bit is cleared */    

while(((HWREG(ulBase + USB_0_CTRL)) & 0x1 )== 1);

执行就不会有问题了。

为啥呢?

好难理解啊……

是USBSS reset以后,立即访问USBSS的寄存器就返回了一个总线错误么?

求解释……