21 HW Processor (HWP) and Sound Output
S1C31D50/D51 TECHNICAL MANUAL
Seiko Epson Corporation
21-5
(Rev. 2.00)
4. Set the SDACDAT.DAT[9:0] bits to 0x000.
(Clear sound data register)
5. Disable SDAC interrupts to occur.
- Set the SDACINTE register to 0x0000.
(Disable interrupts)
- Write 0x0003 to the SDACINTF register.
(Clear interrupt flag)
Initializing HWP (sound play function)
6. Set the HWPCTL.HWPEN bit to 0.
(Disable HWP)
7. Set the following HWP internal register bits (sound play function register bits):
- Set the FUNCTION.ID[7:0] bits to 0x01.
(Select sound play function)
- INTMASK.TO_MUTE bit
(Set mute interrupt mask)
- INTMASK.TO_PAUSE bit
(Set pause interrupt mask)
- INTMASK.TO_PLAY bit
(Set playback start interrupt mask)
- INTMASK.TO_IDLE bit
(Set idle state interrupt mask)
- ROMADDR.ADDRESS[31:0] bits
(Set sound ROM data start address)
- ROMSIZE.SIZE[31:0] bits
(Set sound ROM data size)
- KEYCODE.KEYCODE[31:0] bits
(Set key code)
8. Perform the following settings when using the HWP interrupt:
- Set the HWP interrupt level (refer to the “Cortex®-M0+ Technical Reference Manual”).
- Write 0 to all the interrupt flags in the HWPINTF register. (Clear interrupt flags)
Note: Be aware that the write value to clear flags is different from other peripheral circuits.
- Set the HWPINTE.HWPIE bit to 1.
(Enable interrupts)
Starting HWP operation (sound play function)
9. Set the SDACMOD.PWMOUTEN bit to 1.
(Enable sound output)
10. Enable the external amplifier using a general-purpose output port (if necessary).
*
Set a wait time according to the amplifier specifications after being enabled.
11. Set the HWPCTL.HWPEN bit to 1.
(Enable HWP)
12. Wait until the HWPINTF.HWP0IF bit is set to 1 and the STATE_
n
.STATE[15:0] bits are set to 0x0001
(sp_state_idle = sound play function idle state).
Initialize the SDAC and HWP in this order again if the HWPINTF.HWP1IF bit = 1.
Initialization (when outputting sound from T16B Ch.0 in S1C31D51)
When outputting sound using the T16B Ch.0, initialize the SDAC, T16B Ch.0, and HWP in this order as shown
below.
Initializing SDAC
1. Configure the SDAC output pins as general-purpose ports. (Refer to the “I/O Ports” chapter.)
- P5MODSEL register = (P5MODSEL & 0x00fc)
|
0x0000
2. Configure the SDAC operating clock. (Refer to “Section 21.3, Clock Settings.”)
- Set the SDACCLK.CLKSRC[1:0] bits to 0x02.
(Clock source = OSC3)
- Set the SDACCLK.CLKDIV[1:0] bits to 0x0.
(Clock division ratio = 1/1)
- Set the SDACCLK.DBRUN bit to 1.
(Enable clock supply in DEBUG mode)
3. Set the SDACCTL.SDACEN bit to 1.
(Enable SDAC)
4. Set the SDACDAT.DAT[9:0] bits to 0x000.
(Clear sound data register)
5. Disable SDAC interrupts to occur.
- Set the SDACINTE register to 0x0000.
(Disable interrupts)
- Write 0x0003 to the SDACINTF register.
(Clear interrupt flag)
Initializing
T16B Ch.0
6. Assign the T16B Ch.0 TOUT outputs to the ports (UPMAX) used for sound output.