2015-02-02 04:35 AM
Help me, please.
I've got STM32F042K6T6. I generated project for IAR with STM32Cube. I need use CAN-BUS in my device but i can't, cause it doesn't work. I have CAN transmission in Infinite loop with 100ms delay. First 3 transmissions return timeout error ( /* Check End of transmission flag */ while(!(__HAL_CAN_TRANSMIT_STATUS(hcan, transmitmailbox)))). And then i haven't anymore mailboxes and HAL_CAN_Transmit returns HAL_CAN_STATE_ERROR. I have tested all CAN modes: CAN_MODE_NORMAL, CAN_MODE_LOOPBACK etc. I have got CAN driver SN65HVD233DR. I attach a main.c file to the message. And i see nothing on CAN_TX pin with oscilloscope - only 3.2 Volt. What i'm doing wrong? Help me please! Thanks! #can #hal #bxcan #stm32f0 #bus2015-02-03 05:12 AM
Yes, sure.
Clocks from HSI ________________ Attachments : main.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0gp&d=%2Fa%2F0X0000000bfS%2F1xWRN5SrL3wOtfETmaQvO5xORo6D1hgmQ2c1z4xyeIg&asPdf=false2015-02-03 05:22 AM
Have you enabled your CAN_RX Interrupt function?
If not enable the inteerupt function2015-02-03 09:28 PM
Yes, STM Cube did it.
I have: HAL_NVIC_SetPriority(CEC_CAN_IRQn, 0, 0); HAL_NVIC_EnableIRQ(CEC_CAN_IRQn); in ''stm32f0xx_hal_msp.c'' in ''void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan)'' function. I attached all my 3 files in this message. ________________ Attachments : main.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0uB&d=%2Fa%2F0X0000000bfQ%2FI9legXraf8Bz7lKxHyajHt4v6robwBwNvH4BtBlOv6g&asPdf=falsestm32f0xx_hal_msp.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0u6&d=%2Fa%2F0X0000000bfO%2F8XNgJCHSdSviyXjamEvTnqZECFeA0Tr_NppW1WmEO4g&asPdf=falsestm32f0xx_it.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0u1&d=%2Fa%2F0X0000000bfP%2F3AemOklENAiBtk6G4x5gc32so9nyC6qyed31IuNV1Bw&asPdf=false2015-02-04 12:49 AM
Resolved.
You was right. When I initialized and activated filter all became OK.I
nterrupt
work now and I see received data!
THANKS!2015-02-04 02:01 AM
Can you send me the program
2015-02-04 04:42 AM
Yes, sure.
________________ Attachments : main.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0tw&d=%2Fa%2F0X0000000bfM%2Fhcm9S4SIe.ejGRTBDVW8C7LaIgLX29xTEwfybJq8Guo&asPdf=falsestm32f0xx_hal_msp.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0tr&d=%2Fa%2F0X0000000bfL%2FRVegloo2VpvYXN1MrBikppiAQZPGpTPuMpb8yyIVLsM&asPdf=falsestm32f0xx_it.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I054&d=%2Fa%2F0X0000000bfN%2FWN3xheWJpoQELqtS1MPOwl6dnixSqjXK2N7gKjLVy6Q&asPdf=false