Help to resolve D/A Converter - Page 1
Forum section: electronics / general

author: alizare368
author_rank: Regular Contributor
timestamp: July 06, 2019, 12:06:57 pm
content: HiI used CS4344 sound codec for making the wave player,and it works well,but it has a problem,I have to disconnect and then connect one of the output to start reading,Or activating the output.Shematic is in the attachment.this is my code:Code:int main(void){MX_GPIO_Init();MX_DMA_Init();MX_I2S2_Init();MX_SDIO_SD_Init();MX_FATFS_Init();res=f_mount(&SDFatFs, (TCHAR const*)SDPath, 0);if(res==FR_OK){res=f_open(&MyFile, "2.wav",FA_READ);if(res==FR_OK){f_read(&MyFile,&sai_buf,sample_no*2,&br);f_read(&MyFile,&sai_buf,sample_no*2,&br);}}index_buf++;HAL_I2S_Transmit_DMA(&hi2s2,sai_buf,sample_no);while (1){/* USER CODE END WHILE *//* USER CODE BEGIN 3 */if(refill){refill=0;HAL_GPIO_WritePin(GPIOB,GPIO_PIN_5,GPIO_PIN_SET);res=f_read(&MyFile,&sai_buf[index_buf%2],sample_no*2,&br);HAL_GPIO_WritePin(GPIOB,GPIO_PIN_5,GPIO_PIN_RESET);}}}void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s){HAL_I2S_Transmit_DMA(&hi2s2,sai_buf[index_buf%2],sample_no);index_buf++;refill=1;}someone know what the problem is??

author: Andy Watson
author_rank: Super Contributor
timestamp: July 06, 2019, 12:22:14 pm
content: "CONNECT TO HEADPHONE" ?The datasheet shows a 3.3\$\mu\$F between the chip and the (pressumably) low impedance headphone. I would guess that the chip is waiting to see this capacitance charge up - which will never happen if you've connected the heaphone(s) directly.

author: SiliconWizard
author_rank: Super Contributor
timestamp: July 06, 2019, 01:54:19 pm
content: Yeah this DAC is absolutely NOT designed to directly drive headphones.Besides, its outputs are DC-biased so they require series output caps. See p.15 of the datasheet. Without series output caps, it won't work properly.See p.11 of the datasheet for a typical output filter stage. And add a small headphones amplifier if you're going to use headphones.

author: alizare368
author_rank: Regular Contributor
timestamp: July 06, 2019, 02:12:18 pm
content: Tanks for help me.I put the filter in the output and answered.

author: alizare368
author_rank: Regular Contributor
timestamp: July 10, 2019, 02:38:46 pm
content: HiI want this program execute with RTOS but when it run ,the program enter this function ( void HardFault_Handler(void) ) and doesn't exit.Heap size :0x4096Stak size : 0x4096os_stak size (words): 1048Code:void HardFault_Handler(void){/* USER CODE BEGIN HardFault_IRQn 0 *//* USER CODE END HardFault_IRQn 0 */while (1){/* USER CODE BEGIN W1_HardFault_IRQn 0 *//* USER CODE END W1_HardFault_IRQn 0 */}}someone know??

author: mikerj
author_rank: Super Contributor
timestamp: July 10, 2019, 03:25:03 pm
content: Tracing the cause of hard faults can be difficult, but is very often caused (IME) by uninitialised pointers or unaligned memory access. It seems like you are using an Arm cortex micro (you haven't actually said), in which case the stack frame holds some useful debugging information. Read up onhard fault handling.

author: SiliconWizard
author_rank: Super Contributor
timestamp: July 10, 2019, 03:26:58 pm
content: I suggest the following reading:https://www.freertos.org/Debugging-Hard-Faults-On-Cortex-M-Microcontrollers.htmlEdit: oops, sorry, didn't check that mikerj's link was exactly the same!