cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746 CAN Transmit Code hangs

Rob Ashworth_2
Associate II
Posted on January 03, 2017 at 14:56

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

)

;

}

8 REPLIES 8
Khouloud GARSI
Lead II
Posted on January 06, 2017 at 17:51

Hi

unclefungus

,

I recommend you to refer to the CAN examples under the

http://www.st.com/content/st_com/en/extended-query.html?querycriteria=productId=SC2004$$associatedTo=SS1858

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.

Rob Ashworth_2
Associate II
Posted on January 09, 2017 at 18:24

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'.....

Khouloud GARSI
Lead II
Posted on January 10, 2017 at 10:57

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.

Khouloud GARSI
Lead II
Posted on January 23, 2017 at 14:30

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.

Posted on January 23, 2017 at 14:40

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=false

image2a5d3e.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyxj&d=%2Fa%2F0X0000000bEm%2Fnn.sYAu2aDgDRUDyJ.NXcj.ZchJbzXr1ikSKlfYWkwM&asPdf=false
Posted on February 17, 2017 at 00:16

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?
Posted on February 20, 2017 at 11:25

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6mI&d=%2Fa%2F0X0000000bvB%2FZvkMlTyaeH1yAbg54kdFxVlnl7e4WtXgI0nuNVu8cHI&asPdf=false
Posted on March 01, 2017 at 23:27

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 )