I've been proto typing some nodes to interact with a home automation system that uses CAN as the communication protocol.
I've successfully used the Uno R4 Minima, as this has a built in CAN controller and is also 5v compatible which will make integration with some other legacy gear much easier.
My next stage is to design a custom board, based around the Renases RA4M1 mcu used in the Minima, but in a smaller form factor (QFN40 vs QFP64) as I do not need all of the various IO pins. My design also has the CAN transceiver and a buck boost power supply capable of converting a power supply of up to 24v DC to the 5v required on the board.
Here's my initial schematic, based on the Minima. I realise I will need to remap the pins/ports.
I have incorporated a SWD programming port so that I can upload new hex code using the Renases tools. Ideally I would write a bootloader so that I could upload new application code over the CAN bus - but that is more than a stretch goal at the moment.
Any feedback before start the PCB layout is welcome.
FWIW, this will be produced as a small "network" board approx 36mm wide by 25mm high with a row of 2mm pitch connectors at the base that can then be attached to a variety of physical input modules (e.g. switches and environmental sensors etc) or output modules (e.g. relays, dimmers, motor controllers etc)/
One of the design choices was to omit an external oscillator or crystal.
I had previously done a board based on SAMD21G and added a 32.768Hz crystal along with the two load capacitors.
But for this design I followed the R4 Minima circuit design (ABX00080 v1.2), where interestingly the schematic shows an oscillator (FTX16.000M12SM3S-30/30) but this is not populated, the configuration using the internal high speed oscillator (HOCO) instead.
Yes indeed - however the other three pins for doing the flash loading (RST, SWCLK and SWDIO) are not overloaded for the peripheral I need though.
I'm questioning the need to do real time debugging during development which requires the SWO pin.
I've just downloaded the Black Magic Probe book which has a great section on the use of the SWO pin. This is only required for real time tracing.
Debugging can be done via the SWCLK and SWDIO pins so there is no problem with the CAN bus overloading this pin.
It also looks like it is useful to bring a UART TX pin out for debugging via old school Serial.println commands.
Some progress to report back. I've put together a proto board with a QFP48 variant and a breakout board I had lying around.
I can attach the Black Magic Probe following the directions in the book and when doing the swdp_scan I get
*** 1 Unknown ARM Cortex-M Designer 423 Partno 16 M4
Which is encouraging. I'll now try to see if I can upload a blinky program to get an LED flashing, at which point I can call this sucess.
Well that was a bit optimistic ! The Black Magic Probe that I have access to does not support the Renesas RA series very well, and does not support the RA4M1 at all.
I'll need to see if I can figure out a different programmer (E2 Emulator Lite or J-Link educational)
The question is whether they work just with the SWD port (I think one might required TX/RX ports as well)
Or look at using another 5v tolerant part. NXP seem to have a good range (S32K1x)although I'm not sure there is any Arduino support (despite one of the evaluation boards boasting of Arduino Uno compatibility)
Hi Fastbike, any more progress? I really like the "horsepower" of the UNO R4 and was able to quickly setup can bus demo with cheap TJA1050 drivers. I would like to also make a DIY R4 board that is smaller than the UNO.
I've soldered a 48 pin part to a schmart board adapter, and then used a breadboard to build a working demo.
Because I could not get the BMP to work, I used a JLink edu mini to get a blinky style program working and could vary the blink period by detecting if another pin was grounded or not.
My next task is to add a CAN bus transceiver board, and write a bootloader so I could flash it with a new application program over the wire.
I have designed a small "network" board which incorporates a MCP2652 CAN transceiver, 3 LEDs (power, network, service), buck style power circuit (so board can be powered by 6-24V) and 16 IO pins. This has 2mm pitch connectors along one side: 8 in line for power, network, reset etc. And then 16 in a 2x8 layout for the IO.
The plan is to be make a series of these and then mount them, sub board style, onto other application nodes. At this stage with my home automation project this would be switch/temp/occupancy input nodes and relay/dimmer driver output nodes.
I've been a bit side tracked in the last 3 months installing solar power onto my home and garage, this has become a very hands on project.
Hopefully that project will be finished this month and I can get back onto this project !