cancel
Showing results for 
Search instead for 
Did you mean: 

SWD-CAN bus Bridge

KKT31
Associate II

Hi everyone! I want to have ability to program and debugging STM32 MCU's via CAN: in other words, I like to have functionality of ST-LINK (including connection via STM Studio), but using CAN, not USB. How to implement SWD master, is a any source codes or documents with description of this?

6 REPLIES 6
AvaTar
Lead

Pretty sure such a thing doesn't exist yet, and you are on your own. Can someone prove me incorrect ?

Wouldn't IMHO make sense, the effective throughput would drop by at least one order of magnitude.

How about a MCU with CAN support in the System ROM bootloader, or a second-stage bootloader ?

Basically if you don't know how to implement it already, you're the wrong person to be implementing it. Perhaps start by reviewing how JTAG and SWD systems function. Code for things like OpenOCD might be illuminating, as would technical coverage of ITM and DWT components of the core.

Historically something like a "monitor" application was the thing to use via serial connections. See ARM Angel Monitor http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0066d/Babdcdih.html

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

>effective throughput would drop by at least one order of magnitude

It's no need to monitor the variables in real time, only debug program step by step. For example, some PLC like Danfoss use CAN bus to watch on variables. All I need is making this tracking independent from core. No using of "printf (something)".

>How about a MCU with CAN support in the System ROM bootloader

This bootloader is good idea for updating firmware, but not tracking.

>Basically if you don't know how to implement it already, you're the wrong person to be >implementing it. 

My idea: the board have, simplifying, 2 CPU: 1 - main CPU, which do base program, and 2 - CPU, which can reprogram main CPU and wath for additional information (safety function). CPU#2 receive frames via CAN bus by predefined protocol, hold its in memory , check for errors, and then (if no errors found), load it to CPU#1 via SWD. This is like look what ST-LINK do.

KKT31
Associate II

Here is example of one MCU programming anther MCU

https://github.com/ataradov/embedded-swd

According Author, this is for Microchip devices. But I find, for example:

dap_write_word(DHCSR, 0xa05f0003);

Let's look here:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0337e/CEGCJAHJ.html

Debug Key. 0xA05F must be written whenever this register is written.

Set C_HALT, C_DEBUGEN

I see, it is common for all Cortex M3 devices?

Ok, but wouldn't it be easier just to create a CAN task in the micro-controller, send it the address(es) you want to monitor, and have it send you the content of that location periodically?

Playing man-in-the-middle with a bunch of debugging software you have no ownership of (in the source/accessibility sense) is an uphill task.

And to Avatar's point, it is not really a lack of ability by the debugger vendors to provide this type of connectivity, it's a lack of market, and a lack of performance. They do it with Ethernet because the bus has far more bandwidth, and isn't stuck sending 8-bytes at a time.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..