| Electronic Components Datasheet Search |
|
AN2394 Datasheet(PDF) 9 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN2394 Datasheet(HTML) 9 Page - STMicroelectronics |
|
9 / 13 page ![]() AN2394 Implementation example with STR711F 9/13 3.2 Firmware description The software associated with this application is developed in C using the STR71x Firmware Library from STMicroelectronics. The STR71x Firmware Library provides a set of functions covering the functionality of the STR71x peripheral. As a result, users can develop applications for any STR71x device without an in-depth study of each peripheral specification. Note: The firmware assumes that the .WAV file is stored at address 0x00 of the Flash. The first part of the software performs the configuration of the different system clocks. The main clock (MCLK), PCLK1 (including serial communication peripherals, such as BSPI0) and PCLK2 (including system peripherals, such as TIM0 and TIM3) are set to 32MHz using an external 4MHz oscillator. Once the BSPI0 peripheral and its associated pin are configured, the baudrate is set to 5.3Mb/s. The task of audio playback is achieved by calling the WAVE_PlayBack function. This function starts by a call to the WAVE_Parsing function. This checks the format of the .WAV file and gets information about the audio format. This is done by reading the value of a number of parameters stored in the file header and comparing these to the values expected for the format of a standard .WAV file. If a valid .WAV file format, it continues reading the header to determine the audio format in terms of the sample rate and the sampled data size. If the audio format is supported by this application, it retrieves the audio format in the WAVE_FormatTypeDef structure and returns a zero value. Otherwise the function fails and the return value is nonzero. In this case, the return value specifies the cause of the function fails. The WAVE_PlayBack function tests the value returned by WAVE_Parsing function, if it is a nonzero value the audio playback fails. Otherwise, it configures the TIM0 and TIM3 timers. TIM3 is programmed to generate 125.5kHz PWM signal and TIM0 is programmed to generate an interrupt at frequency equal to the .WAV file sample rate value. Note: As TIM3 OCBR value is fixed to 255, the maximum PWM frequency that can be reached is 125.5kHz. On each TIM0 interrupt, a byte is read from the SPI Flash to update the TIM3 Output Compare A register (OCAR) value. A counter loop operates by counting down from the sampled data size value and when zero is reached the playback is stopped. Usually, to read a byte from the SPI Flash several steps are performed: 1. Drive the S line low to select the device 2. Send read data instruction 3. Send a 3 byte address 4. Send a dummy byte. Then the memory content, at that address, is shifted out on Serial Data Output (Q) 5. Drive the S line high to deselect the device Repeating this procedure for each byte read from the SPI Flash increases the processing time of the TIM0 interrupt service routine. This can affect the CPU load and limits other tasks that the application may demand. |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |