2016-08-13 08:00 AM
HAL_DMA_RegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID, void (* pCallback)(DMA_HandleTypeDef *_hdma))
These are the parameters I am using in my code:HAL_DMA_RegisterCallback(&hdma_dac1, HAL_DMA_XFER_HALFCPLT_CB_ID, MyDmaDac1Callback)Getting errors on this line no matter how many times I try to alter the parameters.Does a practical real-world code example exist to guide me on the proper syntax for this function? Can anyone offer some assistance?Thanks,Christopher #hal-callback-dma-registerSolved! Go to Solution.
2016-08-15 07:25 AM
Hipappas.chris,
This callback function is used in all DMA_FLASHToRAM examples available in the Cube package such asSTM32Cube_FW_F4_V1.0\Projects\STM32F4-Discovery\Examples\DMA\DMA_FLASHToRAM. It is called this way there:/*##-5- Select Callbacks functions called after Transfer complete and Transfer error */
<br> HAL_DMA_RegisterCallback(&DmaHandle, HAL_DMA_XFER_CPLT_CB_ID, TransferComplete);<br> HAL_DMA_RegisterCallback(&DmaHandle, HAL_DMA_XFER_ERROR_CB_ID, TransferError);
-Mayla-
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2016-08-15 07:25 AM
Hipappas.chris,
This callback function is used in all DMA_FLASHToRAM examples available in the Cube package such asSTM32Cube_FW_F4_V1.0\Projects\STM32F4-Discovery\Examples\DMA\DMA_FLASHToRAM. It is called this way there:/*##-5- Select Callbacks functions called after Transfer complete and Transfer error */
<br> HAL_DMA_RegisterCallback(&DmaHandle, HAL_DMA_XFER_CPLT_CB_ID, TransferComplete);<br> HAL_DMA_RegisterCallback(&DmaHandle, HAL_DMA_XFER_ERROR_CB_ID, TransferError);
-Mayla-
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2016-08-15 05:59 PM
2016-08-23 11:24 AM
2016-10-27 07:33 PM
Yes, there are default callbacks, for example:
void I2S_DMATxCplt(DMA_HandleTypeDef *hdma); According to UM1725, if you want to write your own callback you have to assign the function pointer to a variable member: void HAL_UART_TxCpltCallback(UART_HandleTypeDef *phuart) { } hppp->DMA_handle->XferCpltCallback = HAL_UART_TxCpltCallback; Also, you can assign the callback using something like this: HAL_DMA_RegisterCallback(&hppp, HAL_DMA_XFER_CPLT_CB_ID, HAL_UART_TxCpltCallback); I tried both, but no luck. My callback is never executed. The ISR is working fine, but then it executes the default callback. Any ideas?