grblHAL / core

grblHAL core code and master Wiki
Other
330 stars 87 forks source link

use second uart #174

Closed MARIOBASZ closed 1 year ago

MARIOBASZ commented 2 years ago

I would like to be able to send current position data to a second microprocessor, (I don't know whether to receive information). Is it easy to do?

terjeio commented 2 years ago

Which driver?

MARIOBASZ commented 2 years ago

I am using Arduino Due.

terjeio commented 2 years ago

Ok, then the easiest is perhaps enabling MPG_MODE and parsing the data coming from the MPG port. If you are connecting via the programming port another option is to listen in on the TX pin. Both these methods requires a sender requesting a status report at regular intervals or a plugin triggering it when no sender is connected.

If you want your own format and automatic pushing of position data you can write a plugin that opens an UART stream and outputs the data you need. You can use the tick timer (1ms interval) in combination with subscribing to the on_execute_realtime event. An example of how to produce a regular event is in this plugin. I do not have any straigth example code for how to open an UART - the closest ones are the Bluetooth or ModBus plugins.

MARIOBASZ commented 2 years ago

Is it okay to listen to Tx while connected to the computer? If it doesn't cause any inconvenience, I would start by trying that way.

terjeio commented 2 years ago

Is it okay to listen to Tx while connected to the computer?

Yes, I have done so with other boards.

MARIOBASZ commented 2 years ago

Thanks. I'll try that way.