2022-11-13 04:00 AM
2022-11-13 05:19 AM
The Reference Manual shows the bit/wire position of the signal, the filtering allows you to Mask (AND) and Compare the bits that drop out.
Please don't put entire question in Title/Summary. You can edit posts to fix content and formatting.
2022-11-13 09:18 AM
read...here a guy working with stm32 to get CAN data :
https://github.com/karlyamashita/CAN-X/wiki
2022-11-13 11:52 PM
Hey sir the above code is based on other hardware but I have only stm32f103
so I would like to use the ARoozitalab code cause it is based on the same stm32f103 controller can you please help me to modify this code from Keil to the new stm32 cube IDE, mainly I just wanna know the structuring in stm32cude ide to start my code
2022-11-13 11:56 PM
I found this guy's post very useful when i first got started with canbus {german}
https://www.diller-technologies.de/stm32.html
This is what i do after i generated the code with cubeMX: (interrupt triggered canbus Rx)
CAN_HandleTypeDef *_hcan;
CAN_FilterTypeDef canfilter;
void CanSETUPnoFilter(CAN_HandleTypeDef *hcan_object_reference) {
_hcan = hcan_object_reference;
canfilter.FilterActivation = CAN_FILTER_ENABLE; //CAN_FILTER_ENABLE;//CAN_FILTER_DISABLE
canfilter.FilterBank = 0;
canfilter.FilterFIFOAssignment = CAN_FILTER_FIFO0; //CAN_FILTER_FIFO1
canfilter.FilterIdHigh = 0;
canfilter.FilterIdLow = 0;
canfilter.FilterMaskIdHigh = 0;
canfilter.FilterMaskIdLow = 0;
canfilter.FilterMode = CAN_FILTERMODE_IDMASK; //CAN_FILTERMODE_IDMASK;//CAN_FILTERMODE_IDLIST
canfilter.FilterScale = CAN_FILTERSCALE_32BIT; //CAN_FILTERSCALE_32BIT
canfilter.SlaveStartFilterBank = 0;
HAL_CAN_ConfigFilter(_hcan, &canfilter);
HAL_CAN_ActivateNotification(_hcan, CAN_IT_RX_FIFO0_MSG_PENDING); //activate interrupt for received canbus
HAL_CAN_Start(_hcan); //CRANK UP THE MOTORS!! BRRREM BRRREM starts can
}
As i handle the fifo0 received canbus frames inside an interruption , i need to redeclare HAL_CAN_RxFifo0MsgPendingCallback . (is declared as weak somewhere else)
void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan){
decodeIRQReceivedCanBus(hcan);
}