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.

Serial interfaces<br />

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

●<br />

●<br />

Enable top level NVIC interrupts by setting the INT_SCx bit in the INT_CFGSET<br />

register.<br />

Start the DMA by loading the DMA buffers by setting the SC_TXLODA/B (or<br />

SC_RXLODA/B) bits in the SCx_DMACTRL register.<br />

A DMA buffer's end address, SCx_TXENDA/B (or SCx_RXENDA/B), can be written while<br />

the buffer is loaded or active. This is useful for receiving messages that contain an initial<br />

byte count, since it allows software to set the buffer end address at the last byte of the<br />

message.<br />

As the DMA channel transfers data between the transmit or receive FIFO and a memory<br />

buffer, the DMA count register contains the byte offset from the start of the buffer to the<br />

address of the next byte that will be written or read. A transmit DMA channel has a single<br />

DMA count register (SCx_TXCNT) that applies to whichever transmit buffer is active, but a<br />

receive DMA channel has two DMA count registers (SCx_RXCNTA/B), one for each receive<br />

buffer. The DMA count register contents are preserved until the corresponding buffer, or<br />

either buffer in the case of the transmit DMA count, is loaded, or until the DMA is reset.<br />

The receive DMA count register may be written while the corresponding buffer is loaded. If<br />

the buffer is not loaded, writing the DMA count register also loads the buffer while<br />

preserving the count value written. This feature can simplify handling UART receive errors.<br />

The DMA channel stops using a buffer and unloads it when the following is true:<br />

(DMA buffer start address + DMA buffer count) > DMA buffer end address<br />

Typically a transmit buffer is unloaded after all its data has been sent, and a receive buffer is<br />

unloaded after it is filled with data, but writing to the buffer end address or buffer count<br />

registers can also cause a buffer to unload early.<br />

Serial controller DMA channels include additional features specific to the SPI and UART<br />

operation and are described in those sections.<br />

9.8 Serial controller registers<br />

9.8.1 Serial mode register (SCx_MODE)<br />

Address offset: 0xC854 (SC1_MODE) and 0xC054 (SC2_MODE)<br />

Reset value: 0x0000 0000<br />

Table 51.<br />

Serial mode register (SCx_MODE)<br />

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16<br />

Reserved<br />

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0<br />

Reserved<br />

SC_MODE<br />

rw<br />

Bits [1:0] SC_MODE: Serial controller mode.<br />

0: Disabled. 2: SPI mode.<br />

1: UART mode (valid only for SC1). 3: I 2 C mode.<br />

89/215 Doc ID 018587 Rev 2

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

Saved successfully!

Ooh no, something went wrong!