UDPI direct from pi gpio. #908
-
Hi I would like to embed a Tiny in a PI hat I am designing and would like to program it directly from the PI. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 6 replies
-
If it has a UART that can talk to the tinyAVR, serialUPDI (included with the core, as a python script, based on microchip's pymcuprog, >20x performance improvement vs the Microchip version, since as they admitted, they didn't make any attempt to optimize performance. I've seen the stock microchip code upload at like 100-200 bytes/second, due to a combination of poorly chosen defaults and USB latency, the 1/2-16 ms polling period that has to elapse for a round trip of information to get sent to the target and for the response that it sent to become visible to the computer - to reduce the processing burden on the PC, they delay checking USB devices, but on default options, there's a round trip for every 2 bytes written to the flash. It can be lowered to every page of flash requiring like half a dozen round trips on tinyAVR, and slightly less per 512b on Dx-series using the tricks I do in SerialUPDI, and the FT232 and similar parts default to a usb latency timer of like 16ms, but can easily be set to 1 ms if you know about that). But yeah, serialupdi I think would be the thing to try. UPDI is an autobaud, half duplex single wire serial port that runs with 2 stop bits and parity enabled. That's all it is, so the modification to make an ordinary serial adapter speak it is trivial. Most of us use programmers made from standard serial adapters by adding a single diode or resistor. |
Beta Was this translation helpful? Give feedback.
-
Excellent thanks again I will make a Pi to 3216 (I still have heaps of those) breakout PCB and add BAT54 Schottky barrier diode across RX and TX to the 3216 UPDI pin and see how it goes. It will be really cool to have a programmable true real time peripheral connected to a PI. The possibilities are endless. |
Beta Was this translation helpful? Give feedback.
-
So just to see I've got it right. Obvouisly I haven't had a chance to look into serailupdi so if the answer is there then don't bother answering me (and sorry for being so lazy). Thanks for the tip about the board rate it shouldn't be too hard to set that in the PI anyway even hacking out a bitbanged version shouldn't be that hard Actually after just a bit of searching this looks interesting https://github.com/adrianomarto/soft_uart Thanks again Spence. |
Beta Was this translation helpful? Give feedback.
-
Actually as the Pi already supports hardware serial and the device is already configured as ttyS0 I will start with the simplest solution and add the diode (as per instructions) to the default Serial RX and TX then simply set the device as such in the prog.py arguments. If that works it will basically solve my issue as I can just use jumpers to program the tiny then set the pi back to normal serial mode. |
Beta Was this translation helpful? Give feedback.
-
Learning more all the time here's a useful link if anyone else is interested search in the page for uart here https://github.com/raspberrypi/linux/tree/rpi-4.1.y/arch/arm/boot/dts/overlays |
Beta Was this translation helpful? Give feedback.
-
Wow thanks Spence. That sounds easier than I ever imagined. |
Beta Was this translation helpful? Give feedback.
If it has a UART that can talk to the tinyAVR, serialUPDI (included with the core, as a python script, based on microchip's pymcuprog, >20x performance improvement vs the Microchip version, since as they admitted, they didn't make any attempt to optimize performance. I've seen the stock microchip code upload at like 100-200 bytes/second, due to a combination of poorly chosen defaults and USB latency, the 1/2-16 ms polling period that has to elapse for a round trip of information to get sent to the target and for the response that it sent to become visible to the computer - to reduce the processing burden on the PC, they delay checking USB devices, but on default options, there's a round t…