Part Number: AM5728
Tool/software: TI-RTOS
Hi,
Please explain me that what the macro function HW_SYNC_BARRIER is all about ? present in the hw_types.h file.
Thanks,
Ranganath
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: AM5728
Tool/software: TI-RTOS
Hi,
Please explain me that what the macro function HW_SYNC_BARRIER is all about ? present in the hw_types.h file.
Thanks,
Ranganath
Hi Ranganath,
HW_SYNC_BARRIER is executing DSB (Data Synchronization Barrier) assembly instruction. The DSB instruction is a special memory barrier, that synchronizes the execution stream with memory accesses.
pdk_am57xx_1_0_13/packages/ti/csl/hw_types.h
/**
* \brief This macro to use data sync barrier in case of ARM.
* This can not be defined as static inline function. This will be
* called inside every hardware register writes.
* In case cache APIs are implemented to use the hardware register
* write functions, (current implementation) and we call a function
* after actual reg write for cache disable,
* the return address in the stack will be invalid.
*/
#if (defined(__ARMv7) || defined(__TI_ARM_V7__))
#ifndef MEM_BARRIER_DISABLE
#define HW_SYNC_BARRIER() \
{ \
asm(" dsb"); \
}
See also below e2e threads for more info:



And we have also info in ARM docs:


Regards,
Pavel
thanks Pavel Botev.
I am using PROCESSOR-SDK-RTOS-AM57X - pdk_am57xx_1_0_7.
Here, I have slave device over SPI3_CS0. Data rate configured as 32 bits, Phase and Polarity are 0 and bit rate is 1Mhz.
Now, when I try to run loopback SPI3 test, data corruption is observed for SPI3, same code if I try with SPI2 its working properly. based on my debug when HW_WR_REG32_RAW() called it will write Tx data to address 0x480B138 and when In Rx path , it will called HW_RD_REG32_RAW() reading data from 0x480B13C for SPI3. but sometimes after HW_SYNC_BARRIER(); in HW_WR_REG32_RAW() API data corruption happen. Can you please see loopback code for SPI3 which I am attaching. MCSPI_BasicLoopbackExample_am5728.zip