Pointer to struct inside a union throws hard fault.
struct {
unsigned char oned;
unsigned char twod;
}test;
hspi2.Instance->DR = *((uint16_t *)&(test.oned));
struct {
unsigned char oned;
unsigned char twod;
}test;
this works fine.
however,
typedef union {
struct {
uint8_t idType;
uint32_t id;
uint8_t dlc;
uint8_t data0;
uint8_t data1;
uint8_t data2;
uint8_t data3;
uint8_t data4;
uint8_t data5;
uint8_t data6;
uint8_t data7;
} frame;
uint8_t array[14];
} uCAN_MSG;
uCAN_MSG txMessage;
hspi2.Instance->DR=(*((uint16_t *)&(txMessage.frame.data0)));
throws a hard fault although evaluating the expression in watch windows shows proper value. pl help
