2017-01-03 05:56 AM
I am having some trouble with CAN on the STM32F746 DISCO board.
I have a can transceiver connected to PB8/9, but eveytime I try an put a message on the bus, the code just freezes.
I have hade this once before the the SPI bus and it was caused by not enabling the clock on the peripheral bus, but I can't see a similar issue this time. Anyone know what could cause the code to hang?
Code snipped here where it freezes:
if
(
HAL_CAN_Init
(
&
CanHandle
)
==
HAL_OK
)
{
//Everythying OK, so send the message
HAL_CAN_Transmit
(
&
CanHandle
,
10
)
;
}
2017-01-06 08:51 AM
Hi
unclefungus
,I recommend you to refer to the CAN examples under the
package(1.5.0)You can find those examplesunder the path below:
STM32Cube_FW_F7_V1.5.0\Projects\STM32756G_EVAL\Examples\CAN
May this be helpful.
Khouloud.
2017-01-09 09:24 AM
I re-worked an example for the STM32F756 - after considerable work! as there is no CAN example for the DISCO F746 board. Still no joy though. I'm sure it can be done though! The HAL libraries are giving me a headache compared to the 'Standard Peripherals'.....
2017-01-10 01:57 AM
Hi Rob,
I highlighted internally the need to have a CAN example for STM32F746 on our STM32F7 cube package.
We are trying our best to satisfy all of our customers. So, If you have any wishes, other enhancement proposal on our STM32 products, ecosystem and community, please suggest them here:
https://community.st.com/community/stm32-community/stm32-forum/blog/2016/12/30/2017-stm32-wish-list
.Khouloud.
2017-01-23 05:30 AM
Hi Rob,
It is not planned to provide a CAN example for the TM32F746G-Discovery boards because of the hardware; No transceiver is embedded on the board.
Best regards,
Khouloud.
2017-01-23 06:40 AM
I have fixed the issue.
CANTx/Rx wrong way around!
Thanks,
Rob
Robert Ashworth
Electronics Engineer
Sahara Force India Formula One Team
Dadford Road, Silverstone
Northamptonshire, NN12 8TJ
United Kingdom
Email: robert.ashworth@forceindiaf1.com
Tel: +44 (0) 1327850761
________________ Attachments : image05d3fc.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyVy&d=%2Fa%2F0X0000000bEn%2FZbHL4DpjODOSN3gPxdtSAkXuj3a4JG0nIOIT1aSvxbk&asPdf=falseimage2a5d3e.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyxj&d=%2Fa%2F0X0000000bEm%2Fnn.sYAu2aDgDRUDyJ.NXcj.ZchJbzXr1ikSKlfYWkwM&asPdf=false2017-02-16 04:16 PM
I am interessting in your solution. how did you solved it? A transceiver is a cheap chip and good availabe - not an issue.
Would you explain me your solution?2017-02-20 03:25 AM
2017-03-01 03:27 PM
Thank's for the source code. I had decide me to use the 746Disco-Board for a simple display and control unit that not needs more than just some simple snippet's to handle the ethernet especial the BSD sockets of lwip in combination with FreeRTOS 8.2.1. The board's contained MEMS and audio features are not further used. The CAN bus on this board is nice but ST uses a buggy chip (r0p1) on my board, that run's into the ISR, even none breakpoint is placed their. The debuging of source code is a rumble and prevents to get fun. A workaround is available from Segger, but needs to replace the debugger firmware from ST with a J-Link OB variant. This is quite more versatile, faster and it's support's the hole bunch of free segger tools like 'systemview' to record and analyse the timing of each thread and timers in real-time. The disadvantage of the replacement is, that this firmware prevents the usage of sw4stm and all some nice free tools who is limited to use with the ST's Debugger.
I had used the CAN-Bus support with an STM32F407 and an older STM32F103V successfully. I had some various DMA issues but finaly, they can-bus works. By the way, i will hope that you are not use the SDRAM because the clock speed is defined (216Mhz), is to high for the used dynamic memory. The PLL should be limited by 200Mhz instead to take ensure that the memory speed is in a valid range.RCC_OscInitStruct.PLL.PLLN = 400; // 200Mhz
RCC_OscInitStruct.PLL.PLLQ = 7;And later you can reduce the flash latency time at 200Mhz.
if (HAL_RCC_ClockConfig ( &RCC_ClkInitStruct, FLASH_LATENCY_6) != HAL_OK )