Skip to main content
JohnsAby
Associate III
April 29, 2022
Solved

I have configured 2 SPIs in DMA and I need to get callback for both SPIs (HAL_SPI_TxCpltCallback). I am able to get callback when tried individually, but simultaneously used its causes build error. Error[Li006]: duplicate definitions .

Build Error

Error[Li006]: duplicate definitions for "HAL_SPI_TxCpltCallback";

void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
{
 HAL_GPIO_WritePin(SPIx_NSS_Port, SPIx_NSS_Pin, GPIO_PIN_SET);
}

I use the same in both files ?

any way ? please help

This topic has been closed for replies.
KnarfB
KnarfBBest answer
Super User
April 29, 2022

Use one callback only and an if statement in the beginning to find out which hspi is calling.

hth

KnarfB

2 replies

KnarfB
KnarfBBest answer
Super User
April 29, 2022

Use one callback only and an if statement in the beginning to find out which hspi is calling.

hth

KnarfB

JohnsAby
JohnsAbyAuthor
Associate III
April 29, 2022

Thanks KnarfB for the fast response. It worked.