2022-04-07 01:51 AM
i do that in STM Discovery 407 and it is work but the same in stm32f105 do not work ?
2022-04-07 02:11 AM
Hello @MKado.1 and welcome to the Community :)
Please share more details about your issue, so that it will be easier to understand the issue.
When debugging, are there any error ?
Did you checked the CAN examples available in the Cube packages?
Make sure that you configure correctly the CAN (pins, rate, clock, ...)
I advise your to review the CAN example available under STM32CubeF1 MCU package:
STM32Cube_FW_F1_Vx.x.x\Projects\STM3210E_EVAL\Examples\CAN\CAN_Networking
Imen
2022-04-07 02:25 AM
this is my sending function there in no error
void CAN1_TX(uint32_t id,uint32_t dlc,uint8_t frame[8])
{
CAN_TxHeaderTypeDef TxHeader;
uint32_t TxMailbox;
TxHeader.DLC = dlc;
TxHeader.StdId = id;
TxHeader.IDE = CAN_ID_STD;
TxHeader.RTR = CAN_RTR_DATA;
if(HAL_CAN_AddTxMessage(&hcan1, &TxHeader, frame,&TxMailbox) != HAL_OK){
Error_Handler();
}
while(HAL_CAN_IsTxMessagePending(&hcan1, TxMailbox));
}
this is the settings image and the colck is ok 8mhz ext and working on 72mhz
MX_CAN1_Init();
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_15, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_14, GPIO_PIN_SET);
//set filter / mask to accept every identifier
CAN_FilterTypeDef filter = {0};
filter.FilterIdHigh = 0x0000;
filter.FilterIdLow = 0x0000;
filter.FilterMaskIdHigh = 0;
filter.FilterMaskIdLow = 0;
filter.FilterFIFOAssignment = CAN_RX_FIFO0;
filter.FilterBank = 0;
filter.FilterMode = CAN_FILTERMODE_IDMASK;
filter.FilterScale = CAN_FILTERSCALE_16BIT;
filter.FilterActivation = ENABLE;
filter.SlaveStartFilterBank = 0;
if (HAL_CAN_ConfigFilter(&hcan1, &filter) != HAL_OK)
return (1);
HAL_CAN_Start(&hcan1);
i set the filter also and not reciving any thing .. but let me solve the sending befor
and this is the loop for sending and there is a flashin led as you see
if (tm>1000)
{
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_15);
CAN1_TX(0x321,8,Von_260_1);
tm=0;
}
the program is workinh good and flashing the led and go in the function CAN1_TX and do not sending any thing
there is a NUVOTON board connecting to my STM board to recive
and i made tha same thing in STM Discovery working good ... but in STM 105 not working
i do not know what you need to know also ??
thank you for response and i am waiting for the answer :)
2022-04-07 02:27 AM
and there is a logic analyzer connected to the CAN Bas to see the Data but there is no data of course
anf the NUVOTON board sending its data as an ACK for STM board Data