Easiest way to program a ProMini 3,3V 8MHz over Raspberry Pi's GPIO

Hi
I am interfacing an Arduino Pro Mini 3,3V 8 MHz to a raspberry pi that will programm it.

Programming over RX-TX works after having restored /dev/ttyAMA0 to GPIO in the RPi3.
But the reset must be done manually and I want to be able to change the program remotely.

Have we got another easy way to program the Arduino Pro Mini e.g. over SPI and the AVR-ISP interface?
Is that way fully documented?

Would then the programming be doable even when /dev/ttyAMA0 is busy?
Currenty im am using /dev/ttyAMA0 as the communication channel between thr RPi and the Arduino.

I currently need to stop the RPi programm, load the IDE, compile and upload, start again the the RPi programm.

It would be nice to be able reporgramming the Arduino without the above procedure.

Thank you

https://www.microchip.com/webdoc/protocoldocs/protocoldocs.avrispprotocol.html

RIN67630:
Have we got another easy way to program the Arduino Pro Mini e.g. over SPI and the AVR-ISP interface?

There are actually a couple of ways to do this.

One is to use avrdude's "linuxgpio" programmer. I haven't actually tried this, but I know other people are using it to program their Arduinos. I think you'll find some documentation of how to do it with a bit of searching (or maybe someone with experience will show up here and help out.

What I do have experience with is using avrdude's "linuxspi" programmer. I did an investigation of this a while back and documented all my findings here:

At that link, you'll also find a link to SparkFun's article on how they use linuxspi. My goal is to eventually make this programmer extremely easy for Arduino users to install and use. Unfortunately, I discovered that the way the linuxspi code is currently written in avrdude requires that avrdude be run as superuser in order to use the linuxspi programmer. That's no big deal if you're running avrdude from the command line, but it's not so great for people using the Arduino IDE. I improved avrdude so that this is no longer necessary and Arduino has already accepted my fix into their version of avrdude. Unfortunately, Arduino has not made a new release of avrdude since that time. So I'm simply waiting until Arduino releases a new avrdude version, after which I'll complete my project.

pert:
There are actually a couple of ways to do this.

One is to use avrdude's "linuxgpio" programmer. ...
What I do have experience with is using avrdude's "linuxspi" programmer.

Did I understand it right that the linuxgpio method is a two step process: compile to .hex and subsequently invoke a modified avrdude, whereas you way includes a new "programmer in the IDE an will enable the usual "upolad" without further steps?

Will it run without flaw if the IDE is called with sudo?
Does it require that the /dev/AMA0 is released before uploading?

Thank you and regards.
Laszlo

RIN67630:
Did I understand it right that the linuxgpio method is a two step process: compile to .hex and subsequently invoke a modified avrdude, whereas you way includes a new "programmer in the IDE an will enable the usual "upolad" without further steps?

A programmer definition could be added to the Arduino IDE for either option. I'm not sure if any examples exist for a linuxgpio programmer definition for the Arduino IDE, or whether the issue I found with linuxspi also occurs with linuxgpio. Since this is turning your Raspberry Pi into an ISP programmer, you would use the Arduino IDE's Sketch > Upload Using Programmer rather than the standard Upload (unless you're using a board like some of the ATtinys that makes Upload act as Upload Using Programmer).

RIN67630:
Will it run without flaw if the IDE is called with sudo?

It's been a while, but my recollection is that the problem still occurred when the IDE was run with sudo. I'm not certain of that though. I found the "real" solution to the problem once I spent a little time on it and didn't look into workarounds any more after that.

RIN67630:
Does it require that the /dev/AMA0 is released before uploading?

No. This is an ISP programming operation so it doesn't require any access to the serial port.

pert:
No. This is an ISP programming operation so it doesn't require any access to the serial port.

Fine. Just a last question: since the arduino is intended to stay connected to the GPIO, what is the impact onto the SPI functionality of the Arduino?
Would I not have got a conflict between the SPI outputs of the arduino and those of the Raspberry Pi?
Does the software leave the GPIO outputs as inputs after programming?

I don't know the answer to that question. I guess you could just try it out and see what happens.

pert:
I don't know the answer to that question. I guess you could just try it out and see what happens.

I tried, but got a bench of broken pipe errors.
I am trying my luck with asking in the avrdude folder, where my question is better placed.

From that thread:
http://forum.arduino.cc/index.php?topic=602623
It sounds like the "Broken pipe" error are occurring during a completely different process from the ones I mentioned here. You are trying to do a standard upload over the UART, not an upload via an ISP programmer.

Arduino IDE doesn't lock the programming serial line, but Serial Monitor does.

So there-s no need to re-launch the IDE every new compile, just leave it opened and make sure the Serial monitor is closed.

Yeah the application must either be killed & restarted but in a terminal window that can be as simple as CTRL-C (upload) ARROW-UP, ENTER.

Or implement a signalling in your app to temporarily close the serial line when other program needs to use the serial line.