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.
DMA_configAddresses(DMA_CH5_BASE, (uint16_t *)(SPIB_BASE + SPI_O_TXBUF),(Uint16 *)&cpu_dma_para);
DMA_configBurst(DMA_CH5_BASE, 1, 1, 0);
DMA_configTransfer(DMA_CH5_BASE, 16, 1, 0);
DMA_configMode(DMA_CH5_BASE, DMA_TRIGGER_SPIBTX, DMA_CFG_ONESHOT_DISABLE |
DMA_CFG_CONTINUOUS_DISABLE | DMA_CFG_SIZE_16BIT);
定义结构体如下,发送时用示波器测量发现发送Rt_Data_Fault后多发了个0x0000,导致最后16位CRC没发送出
typedef struct
{
Uint16 First_Num;
Uint16 Rt_Data_Runmode;
Uint16 Rt_Data_Fault;
Uint32 Rt_Data_Cur;
Uint32 Rt_Data_Vbat;
Uint32 Rt_Data_Vtem;
Uint32 Rt_Data_Vpol;
Uint32 Rt_Data_Power;
Uint32 Rt_Data_R;
Uint16 CRC;
}CPU_DMA_PARA;
更改结构体如下就可以正常发送,请问这种在不更改结构体的情况下如何对齐数组或者怎么解决此类问题
typedef struct
{
Uint16 First_Num;
Uint16 Rt_Data_Runmode;
Uint32 Rt_Data_Cur;
Uint32 Rt_Data_Vbat;
Uint32 Rt_Data_Vtem;
Uint32 Rt_Data_Vpol;
Uint32 Rt_Data_Power;
Uint32 Rt_Data_R;
Uint16 Rt_Data_Fault;
Uint16 CRC;
}CPU_DMA_PARA;
sizeof()应用时也会有问题:例如sizeof( _tagSingleConditionOption)是4,正常应该是3
typedef struct tagSingleConditionOption
{
uint16_t _OperationMode; //到达条件后的处理方式(1:等待; 2:停止)
int32_t _X; //条件
} _tagSingleConditionOption;