01.06.2014 Views

STM32W108C8

STM32W108C8

STM32W108C8

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>STM32W108C8</strong><br />

Serial interfaces<br />

offset is 4 characters ahead of the actual overflow at the input to the receive FIFO. Two<br />

conditions will clear the error indication: setting the appropriate SC_RXDMARST bit in the<br />

SC1_DMACTRL register, or loading the appropriate DMA buffer after it has unloaded.<br />

9.6.5 Interrupts<br />

UART interrupts are generated on the following events:<br />

● Transmit FIFO empty and last character shifted out (depending on SCx_INTMODE,<br />

either the 0 to 1 transition or the high level of SC1_UARTTXIDLE)<br />

● Transmit FIFO changed from full to not full (depending on SCx_INTMODE, either the 0<br />

to 1 transition or the high level of SC1_UARTTXFREE)<br />

● Receive FIFO changed from empty to not empty (depending on SCx_INTMODE, either<br />

the 0 to 1 transition or the high level of SC1_UARTRXVAL)<br />

● Transmit DMA buffer A/B complete (1 to 0 transition of SC_TXACTA/B)<br />

● Receive DMA buffer A/B complete (1 to 0 transition of SC_RXACTA/B)<br />

● Character received with parity error<br />

● Character received with frame error<br />

● Character received and lost when receive FIFO was full (receive overrun error)<br />

To enable CPU interrupts, set the desired interrupt bits in the second level INT_SCxCFG<br />

register, and enable the top level SCx interrupt in the NVIC by writing the INT_SCx bit in the<br />

INT_CFGSET register.<br />

9.7 Direct memory access (DMA) channels<br />

The <strong>STM32W108C8</strong> serial DMA channels enable efficient, high-speed operation of the SPI<br />

and UART controllers by reducing the load on the CPU as well as decreasing the frequency<br />

of interrupts that it must service. The transmit and receive DMA channels can transfer data<br />

between the transmit and receive FIFOs and the DMA buffers in main memory as quickly as<br />

it can be transmitted or received. Once software defines, configures, and activates the DMA,<br />

it only needs to handle an interrupt when a transmit buffer has been emptied or a receive<br />

buffer has been filled. The DMA channels each support two memory buffers, labeled A and<br />

B, and can alternate ("ping-pong") between them automatically to allow continuous<br />

communication without critical interrupt timing.<br />

Note:<br />

DMA memory buffer terminology:<br />

● load - make a buffer available for the DMA channel to use<br />

● pending - a buffer loaded but not yet active<br />

● active - the buffer that will be used for the next DMA transfer<br />

● unload - DMA channel action when it has finished with a buffer<br />

● idle - a buffer that has not been loaded, or has been unloaded<br />

To use a DMA channel, software should follow these steps:<br />

● Reset the DMA channel by setting the SC_TXDMARST (or SC_RXDMARST) bit in the<br />

SCx_DMACTRL register.<br />

● Set up the DMA buffers. The two DMA buffers, A and B, are defined by writing the start<br />

address to SCx_TXBEGA/B (or SCx_RXBEGA/B) and the (inclusive) end address to<br />

SCx_TXENDA/B (or SCx_RXENDA/B). Note that DMA buffers must be in RAM.<br />

● Configure and initialize SCx for the desired operating mode.<br />

● Enable second level interrupts triggered when DMA buffers unload by setting the<br />

INT_SCTXULDA/B (or INT_SCRXULDA/B) bits in the INT_SCxFLAG register.<br />

Doc ID 018587 Rev 2 88/215

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!