Electronics > Projects, Designs, and Technical Stuff

Wannabe CAN bus implementation

(1/2) > >>

aheid:
My STM32G031 does not have a CAN peripheral. However I'm not that interested in the CAN protocol itself, but the CAN physical layer suits my project nicely.

So I was thinking, its USART does have a synchronous mode where it samples RX when it sends data on TX, ala SPI.

Could this be used along with a CAN transceiver like this[1] to implement a CAN-ish bus between my own devices, or am I missing something?

The idea being that when transmitting, to use the synchronous mode to read back from the transceiver what is on the CAN lines and then compare with what was sent. If different, do some collision handling ala Ethernet or something. In my project each sender would have a unique ID/address which could be transmitted to ensure no two nodes starts transmissions the same way.

To receive data, I imagine regular async UART mode could be used.

Is my late night idea dumb or not?

[1]: https://www.microchip.com/wwwproducts/en/ATA6561

T3sl4co1l:
No need for synchronous mode, if you have full duplex just wire RXD to TXD via the interface and detect differences there. :)

Tim

Jeroen3:
RS-485 is electrically very similar.

aheid:

--- Quote from: T3sl4co1l on July 16, 2020, 05:43:33 am ---No need for synchronous mode, if you have full duplex just wire RXD to TXD via the interface and detect differences there. :)

--- End quote ---

 :palm:  :-DD

Ok, so rest of scheme sounds ok then?

aheid:

--- Quote from: Jeroen3 on July 16, 2020, 06:08:14 am ---RS-485 is electrically very similar.

--- End quote ---
I considered this, but from what I could see, the RS-485 drivers were not nearly as robust against transients, common mode voltage etc. And the CAN bus drivers were cheaper as well, at least for lowish numbers on DigiKey.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod