
EM358x
130
Rev. 0.4
enumeration process. The GPIO and interrupt configuration used follows the same procedure described for
External Interrupts.
Configure the GPIO as a simple input.
Disable interrupt triggering by clearing to 0 the IRQ register being used for the GPIO. This will be one of
the registers GPIO_INTCFGA, GPIO_INTCFGB, GPIO_INTCFGC, or GPIO_INTCFGD.
Ensure the interrupts start from a clean state by writing the necessary bit in INT_CFGCLR register and
the INT_GPIOFLAG register.
If using the selectable interrupt IRQC or IRQD, write the register GPIO_IRQCSEL or GPIO_IRQDSEL
with the value corresponding to the GPIO being used.
Set the IRQ configuration, as defined in the register GPIO_INTCFGA, GPIO_INTCFGB, GPIO_INTCFGC,
or GPIO_INTCFGD, to the value 3. The value 3 enables triggering on a falling or rising edge.
Enable the top level interrupt in the NVIC by setting the appropriate bit the INT_CFGSET register.
Because the USB specification requires the enumeration pull-up to track the state of VBUS, software on the
EM358x must be sure to specifically read the VBUS monitoring GPIO to check the state of VBUS before the
monitoring IRQ edge detection interrupt has taken over.
Once the USB registers and software configuration has been set up, enumeration can be begin by setting the
GPIO used for control of the enumeration pull-up to an push-pull output set high.
9.11 DMA Usage and Transfers
To transfer IN data, data must first be put in an endpoint buffer’s RAM. Once the buffer’s RAM has data, the
register USB_TXBUFSIZEEPxy for that endpoint must be set with the number of bytes to be transmitted.
Transmission is then started with loading the buffer by setting the appropriate USB_TXLOADEPxy bit in the
USB_TXLOAD register.
A buffer should not be modified while the USB_TXLOADxy bit is still set. Modifying a buffer’s RAM before the
buffer has unloaded could result in incorrect data being transferred.
Setting the register USB_TXBUFSIZEEPxy to 0 to transmit a zero length packet is valid and in this situation the
data in buffer’s RAM does not matter.
Because the interrupt INT_USBTXACTIVEEPx will fire on the falling edge of the status bit USB_TXACTIVEEPxy,
the INT_USBTXACTIVEEPx interrupt can be used to keep loading data transmission without any foreground
processing involvement.
Buffer B will only be used if double buffering is enabled. The USB peripheral will always use buffer A if buffer A
has been loaded when the host begins a transfer, regardless of buffer B having data. The USB peripheral will only
transfer from buffer B if buffer B is loaded and buffer A is not loaded.
Receiving OUT data is directly put into the appropriate endpoint buffer’s RAM. Handling this OUT data is best
driven by the interrupt INT_USBRXVALIDEPx. This interrupt will fire on the rising edge of the appropriate
USB_RXVALIDEPxy status bit. Once the received data is in RAM and marked valid, the number of bytes received
is shown in the register USB_RXBUFSIZEEPxy. Reception of a zero length OUT transaction will set the RX
registers and interrupt bits but will not affect any data already in the buffer’s RAM.
When reception processing is finished, the appropriate USB_RXVALIDEPxy bit in the USB_RXVALID register
must be set. If USB_RXVALID is not cleared by writing a 1 to the USB_RXVALIDEPxy bit, further reception will
stall.
Like the IN direction, buffer B will only be used if double buffering is enabled. The hardware will always transfer
into buffer A if it is free, and will only transfer into buffer B if the USB_RXVALIDEPxA bit for buffer A has not been
cleared.
Содержание EMBER EM358 series
Страница 2: ...EM358x 2 Rev 0 4 ...
Страница 7: ...EM358x Rev 0 4 7 ...