AnsweredAssumed Answered

STM32F427 CAN1 crashes SPI2

Question asked by White.John on Sep 13, 2016
Latest reply on Sep 14, 2016 by White.John
STM32Cube FW_F4 V1.13.0

I have a board using CAN1, CAN2, SPI_1 and SPI_2
All functions work independantly fine CAN1 and CAN2 work in Polling mode and Interrupt mode.
SPI_1 and SPI_2 work OK in polling mode using as follows:-
HAL_SPI_TransmitReceive(&hspi1, SPI_Data_Wr_ADC1, SPI_Data_Rd_ADC1, 27, 100); // for SPI2 use (&hspi2)

CAN1 and CAN2 work OK using as follows:-   // (hcan2) for CAN2

           hcan1.pTxMsg->StdId = Out_ID;
           hcan1.pTxMsg->DLC = 8;
           hcan1.pTxMsg->RTR = CAN_RTR_DATA;
           hcan1.pTxMsg->IDE = CAN_ID_STD;
    
           hcan1.pTxMsg->Data[0] = byte1;                                         
           hcan1.pTxMsg->Data[1] = byte2;                             
           hcan1.pTxMsg->Data[2] = byte3;                             
           hcan1.pTxMsg->Data[3] = byte4;
           hcan1.pTxMsg->Data[4] = byte5;                            
           hcan1.pTxMsg->Data[5] = byte6;                                        
           hcan1.pTxMsg->Data[6] = byte7;                        
           hcan1.pTxMsg->Data[7] = byte8;

           if(HAL_CAN_Transmit_IT(&hcan1) != HAL_OK)
                        {
                            
                            Error_Handler(); // Send my Error
                            
                        }


The code works fine until CAN1 transmits an ID greater that 0x03 in StdID which stops SPI_2 from working, SPI_1 continues to work OK, this fault occurs only in CAN1 if CAN2 Transmit is used all works fine.

I have not used any debug as not sure if fault is generated by CAN1 and it's effect on SPI_2

Any help would be appreciated. KR John W

Outcomes