Programming PADI with Arduino IDE
#1
This thread aims to be a complete guide to programming the PADI with the Arduino IDE for OSX, Windows and Linux.

Download the latest version of the Arduino IDE.
On Linux or Windows it is recommended to run it in portable mode, on OSX this is not possible.

Install the latest stable version of the 0.9.x (not 0.10.x) versions of OpenOCD. Prebuild binaries can be downloaded from the gnu-mcu-eclipse page for all supported operating systems.

In your Arduino IDE installations add these two urls to the additionals board managers:

Code:
https://github.com/Ameba8195/Arduino/raw/master/release/package_realtek.com_ameba_index.json,
https://github.com/gtalusan/PADIIoTStamp/raw/master/release/package_padiiotstamp_index.json


Go to "Tools" -> "Board" -> "Boards Manager" and install both "Realtek Ameba Boards" and the "padiiotstamp" packages.
If necessary update the platform.txt file of "padiiotstamp" package to point to the correct OpenOCD installation, on Windows it is also necessary to hardcode the path to the output binary (ram_all.bin) in this same file.

If you are using the JLINK adapter you might have to add this line the 
/Path_to_OpenOCD/scripts/interface/jlink.cfg file to automatically switch to SWD instead of JTAG.
Code:
transport select swd



Select the board "PADI IoT Stamp" and select your JTAG device type. Your PADI can now be programmed.
  Reply
#2
Thanks for writing this up, once I have some free time I need to get back to playing with my PADIs...
Come have a chat in the Pine A64 IRC channel >>
  Reply
#3
(06-13-2017, 03:30 PM)xalius Wrote: Thanks for writing this up, once I have some free time I need to get back to playing with my PADIs...

Agreed-- my thanks too!

... this may be a game changer for folks needed to customize the padi;  also, this may be what tllim has in mind with the PADuino !

Shy
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#4
It took me a full day to get it working because of all this easy to fix but hard to find issues. If some things are not clear enough or anyone has any additions I'm happy to edit the first post.

Programming this board is a lot of fun and you don't need any additional mcu.
  Reply
#5
(06-14-2017, 02:35 PM)thomash Wrote: It took me a full day to get it working because of all this easy to fix but hard to find issues. If some things are not clear enough or anyone has any additions I'm happy to edit the first post.

Programming this board is a lot of fun and you don't need any additional mcu.

Congratulations thomash on getting to this milestone.

The instructions you provided worked for me, after I noted your comment about 
OpenOCD 9. I had been banging my head on OpenOCD 10 for several days. 
The same process with openocd 10 failed by making the padi swd 
programmer look/act bricked, unable to change the transport to swd.

reverting to OpenOCD 9 worked on second try...

Other experiences that might be of interest to others:

Experience 1:
Hosting from debian 8.7 with x86_64 architecture failed because there 
were no hosts for my platform in package_padiiotstamp_index.json. Adding 
"x86_64-linux-gnu" , "i686-linux-gnu" successfully installed openocd_tools 
( since the tools were not architecture dependant).

I had to make similar changes to Ameba8195 since my platform identified as 
"X86_64-linux-gnu" instead of the provided "X86_64-pc-linux-gnu"

In both cases I just served locally modified package.[].json files 
for preferences.txt.


experience 2:
hosting from debian8.7 on raspberry pi 3
 
 When my swd programmer looked bricked, I tried moving to using a 
raspberry pi as the programming host. This does work as far as SWD 
goes, but fails for PADIIoTStamp AND Ameba8195 because neither offers
the "arm-linux-gnueabihf" host in the respective package.[].json files.
 
 Making the same changes as for x86_64-linux-gnu but substituting 
"arm-linux-gnueabihf". You also need to add a stanza to point to a locally 
modified ameba_tools for the raspberry pi executables. You also need a 
stanza pointing to downloads.arduino gcc-arm-none-eabi for arm.  
This was a "close, but no cigar" attempt so I am back to X86_64 until 
I deliver some projects.

Thanks again for reporting success.
  Reply
#6
Thanks for writing this up, once I have some free time I need to get back to playing with my PADIs...
  Reply
#7
Hello guys.  I am new to Padi IOT Stamp and SWD.  This is my maiden post.

After following your instructions thomash I made some progress but have run up against a brick wall.  Here is the output from the Arduino IDE after attempting to upload to the Stamp...

Arduino: 1.8.1 (Windows 10), Board: "PADI IoT Stamp, JLink"

Sketch uses 271732 bytes (10%) of program storage space. Maximum is 2499639 bytes.
C:\Users\Ron_2\Desktop\OpenOCD9\openocd-0.9.0\openocd-0.9.0\bin\openocd -f interface/jlink.cfg -f C:\Users\Ron_2\AppData\Local\Arduino15\packages\padiiotstamp\tools\openocd_tools\0.0.1/rtl8710.ocd -c init -c reset halt -c rtl8710_flash_auto_erase 1 -c rtl8710_flash_auto_verify 1 -c rtl8710_flash_write {C:\Users\Ron_2\appdata\local\arduino15\packages\padiiotstamp\realtek\tools\ameba_tools\1.0.9}/ram_all.bin 0 -c reset -c shutdown 
Open On-Chip Debugger 0.9.0 (2015-05-19-12:06)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : JLink SWD mode enabled
swd
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
rtl8710_reboot
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Error: Cannot find jlink Interface! Please check connection and permissions.

the selected serial port 
 does not exist or your board is not connected

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

So, I don't have the knowledge to solve this one on my own.  Any ideas?  I can connect to the Stamp using J-Link Commander.
My Board shows up as "PADI IoT Stamp" and OpenOCD is "JLink".  "Port" is greyed out.
  Reply
#8
Is libusb installed? What do you see in dmesg output after connecting the programmer? Did you try it with root privileges, maybe it is a permissions problem?
Come have a chat in the Pine A64 IRC channel >>
  Reply
#9
libusb0.dll and libusb-1.0.dll exist within the openocd/bin directory. Is that what you are referring to? As far as root  permissions go, I am using Windows 10 and don't know anything about Linux.  I did try to run the Arduino IDE as an administrator but it had no effect.

I had my J-Link and a serial adapter attached to the Stamp when I tried to download to the Stamp.  No luck.  The orange bar in the arduino ide says that "the selected serial port does not exist or your board is not connected".  My J-Link will connect using J-Link Commander and I can connect with the Stamp using the serial port but the Arduino IDE is not downloading  the compiled program properly.  I did follow the instructions in the first post in this thread and this is where I am stuck.

This is my first time trying to program the Padi IOT Stamp.  I have been working with Arduino for a few years but my "in depth" technical skills are low.  I do not understand what goes on behind the scenes, and can be at a loss if things don't go right the first time!
  Reply
#10
what com port is shown in device manager for the padi?
is it the same com port listed in arduino?
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  PADI IoT Stamp CAD file collection thomash 2 971 09-05-2017, 08:07 PM
Last Post: machinehum

Forum Jump:


Users browsing this thread: 1 Guest(s)