Co-Processor communication

Hi, I’ve just got a huge job that will involve a massive PCB, The G120 will be excellent for the front end display/networking etc. but there are time critical elements to the project as well. So I’m thinking of a PCB that will require a single G120 and up to 8 G30’s. It’s totally insane right! I’ve not got the slightest clue yet how I would do it. There are no size constraints so I might even use the G30 through hole modules. At least I can remove them if I need to update the software then. I had a crazy idea that I might be able to deploy to the G30’s over UART through the G120, since all the G30’s would use the same software, would that even be possible. Then I could use IFU for the whole board.
What would be the best for all of the chips to communicate, CAN? If I were to use CAN, I would need to use both interfaces on the G120, because there will be 10 of these large boards on another CAN network as well. So I would kind of need an internal and external CAN interface. Maybe something other than CAN, although I really need 2-way communication. Has anyone done anything like this before, suggestions?

There are a lot of questions here, huge thanks in advance.

UART would be nice for Point to Point communication, but G120 only has 5 UART’S I think.
CAN would be good, but you need CAN transceiver on both sides, since you can not connect them on TTL Level, and I’m not sure if G30 supports CAN.
And why do you need 8 G30’s what do you want to do with them?

Also when you write time critical:
You might consider using Native micros, like some XMega or whatever, … In NETMF you always have to fear that GC will Interrupt you.

Beagle Bone Black. Or you can wait for the Module by GHI. The PRUs will give you the real time stuff, and the Linux OS will give you the interface stuff.

What kind of functions will the slave processors (G30’s) be doing? Are they just handling simple bit I/0, on’s and off’s or more complicated functions with communications or analog I/O processing.

How fast, or often, do the slave processors need to update the master (G120)? And how time critical do those updates need to be?

How complex is the thing, the G30s have to do? Maybe a small ATtiny/ATMega or something is enough, they could comunicate via I2C or SPI plus an interrupt to tell the G120 they have data for him. Is the whole thing time-critical or just single functions? Maybe RLP is enough?
Just some thoughts, as I can’t imagine what you exactly want to do :)…

The g30’s need to monitor analogs, do complex math, monitor interrupts drive half a dozen outputs each. The communication doesn’t have to be quick either and could be instigated by the g120. Could I use a single UART from the g120 to every g30, and use some gpios to act as a type of chip select.

I’m assuming that I can switch the g30’s com port pins that aren’t selected, to high z so that they don’t effect communication on the lines.

Don’t think you can put the driver into a high impedance state whilst the UART is active. Why not just add a low cost RS485 driver IC and then you have multi-drop that just works. The MAX13487 does the auto transmission so no need for any GPIO pin to control the tx. Only downside is that it is only available in 5V versions only.

So this.

Connected like this.

One for each chip?
and can you explain what the 74LVC1G57 is for?

Thanks, Dave you’ve got to let me buy you a drink sometime.

I’ve got no exp with RS485, from what I can tell it is similar to CAN, but everywhere says that it doesn’t have collision detection, but that this can be done in software. Is this correct? and if so, is it hard to write software to detect collisions. I guess I could just use the g120’s as a type of master on the bus, and set the g30’s to only spit out data on request. right?

74LVC1G57 is being used as a logic level converter.

Correct. The RS485 bus with a UART is a master-slave type so you need a master to request the data from the slaves. A ready made protocol for this that just works is Modbus. :slight_smile: The Modbus driver in Codeshare almost works with UART but has an issue when more than 1 device is present due to the fact it can’t handle devices that respond too quickly. If all your devices on the bus are NETMF based this should not be an issue. I posted a fix to improve the code. It will make your design so much quicker to develop if you have the code space to use it.

Making your own protocol though is not hard.

1 Like

If you have a Auto select Driver like the MAX Dave mentioned, then RS485 works nearly exact as RS232.
The only difference ist: Only one device must send at any time. All devices will see the sent data.
So you need to use a protocoll that includes the device address.
Modbus provides this, and MODBUS RTU is specifically designed for RS485.
If you use a Driver without Auto select, you Need one GPIO to Switch between read and write.
My MODBUS Library on Code share can handle all of this and is used in an industrial application by me.
Pleas don’t expect it to be perfect, but it’s working verry well for me.

1 Like

Yes, I’ve just been going over your work an it’s looking like that’s what I’ve got to use. I’m out of my depth here, so expect more questions to come.

Thanks for all the work.

On this page you mention a constructor that utilises a read and write pin.

If I have this feature, would I be able to use this part instead.

Then it is all kept at 3.3 volts and I don’t need the logic level converters.

Just a quick note when it comes to using 485. I’ve used the GHI 485 module now several times in the past, and the one thing I’ve noticed, is that if you loose power to the Processer & 485 board, it will pull down the entire network of 485 devices. Basically was eavesdropping on the network for logging purposes, and ended up switching to RS232 via a RS485 radio link, simply for isolation to avoid this problem as everything I do has to fail safe to a known state.

Given that the G30’s have 2 Uarts, and the G120 has 5 Uarts,
Com1 on G120 as TX
Com2 on G120 as RX

Com1 on G30’s as RX
Com2 on G30’s as TX

All Com1’s are connected together, and all Com2’s are connected together.

Then you have full duplex communication, using an Industrial Modbus Protocol, without the need for additional hardware and or chip select, as the G30’s would only respond to a poll from the master.

This is one of the reasons that CAN bus is preferred for fault tolerant systems. The driver IC can’t hold the bus in a known state even if powered off.

I don’t believe that you can just connect the TXs of multiple serial ports together. They are each sourcing current. They might be a way to do this with diodes? You also have to be sure the master’s TX port is able to drive all the slave RX ports. There are limitations.

You need a multi master communication protocol to connect multiple masters together. i2c, CAN have such things.

Yes, this should work.
I’m not a Hardware guy. But I think we use something similar.