Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : File Transfer from Pico
Page 1 of 2 | |||||
Author | Message | ||||
Dinosaur Guru Joined: 12/08/2011 Location: AustraliaPosts: 311 |
Hi All Trying to transfer .bas program from Rpi Pico back to a Linux PC. I am at a loss (having never used Xmodem or TFTP before) as to the steps to achieve a transfer. So, from the MMBasic manual it seems easy to set up: I have my Linux PC connected via a Terminal in which I type: XModem send "Myfile.bas" After which it tries to connect to a server. If I open a program called Minicom it reports an error Device /dev/ttyACM0 is locked. which it is, because the terminal window is using it. I am sure I am missing something very simple, but can't get my head around using the usb connection to provide a Terminal for the Pico and at the same time get a file transfer happening. If you do this everyday without thinking about it , would love to hear how. EDIT:The manual states:however when I type TFTP -i 192.168.0.101 PUT "MyFile.bas" it responds with unknown command.Similarly when I just enter TFTP. Edited 2023-12-05 13:44 by Dinosaur Regards Hervey Bay Qld. |
||||
vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1110 |
list all Visit Vegipete's *Mite Library for cool programs. |
||||
Dinosaur Guru Joined: 12/08/2011 Location: AustraliaPosts: 311 |
Hi All Using Konsole in Linux and then List All, then Select all, Save as. That's how I got it to work. KISS principle I guess Regards Hervey Bay Qld. |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3200 |
The PicoMite is the server. You need to enter that command on the client (ie, your Linux desktop or laptop) but, because you are getting the file, you use: TFTP -i 192.168.0.101 GET "MyFile.bas" Geoff Geoff Graham - http://geoffg.net |
||||
Dinosaur Guru Joined: 12/08/2011 Location: AustraliaPosts: 311 |
Hi All Thanks for that Geoff, but what is required at the Pico end.? Does it respond to the request without any input from me ? Regards Hervey Bay Qld. |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2143 |
Try it! If the file is there it will get got. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6104 |
TFTP is running in the background on the WEBmite so you can GET a file while your main program is off doing it's own thing. Very handy. Note: You cannot use TFTP via the USB connection. It only works with TCPIP. Jim Edited 2023-12-05 17:21 by TassyJim VK7JH MMedit MMBasic Help |
||||
Dinosaur Guru Joined: 12/08/2011 Location: AustraliaPosts: 311 |
Hi All Even though I have another way of doing this, I need to complete this to know how and when it does work. I quit out of the running program on the Pico. Then on the Rpi-Zero I did: TFTP -v TFTP> Trace Got "Packet Tracing On." TFTP>Get MyFile.bas received DATA <block=1, 0 bytes tftp> Checked the file created and it is empty (0 bytes long) However on the Pico: TFTP request to read ascii file : MyFile.bas sent RRQ <file=MyFile.bas,mode=netascii> TFTP transfer complete. So where did I go wrong ? Regards Hervey Bay Qld. |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3819 |
That would _send_ from Linux. I think you want to receive there... I wonder, too, if doing a send that didn't complete will have damaged the file on the Pico? I believe not but be sure to check. John Edited 2023-12-05 20:52 by JohnS |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6104 |
Try binary mode. ASCII can be strange at times. VK7JH MMedit MMBasic Help |
||||
Dinosaur Guru Joined: 12/08/2011 Location: AustraliaPosts: 311 |
Hi All Hate it when you Log in, start typing, then go looking for info, then finish your typing and post. Only to find out you have been logged out without any notice and you have to do it all again. As a reminder: Rpi Pico on Hotspot to Rpi Zero with Debian Linux. Tried every combination of TFTP with ,-v ,Trace ,Binary , ascii, netascii , get File in upper lower case. Saved file to Flash location 1 Changed network from Hotspot to my local Wifi. Changed link from Pico to my Desktop (Debian) Checked permissions so all are allowed. Ping on IP to prove it's alive. So, other than one question, I am looking for other suggestions. Can I even send the one and only executable file from the prompt ? All of them report at the Pico end that the send was completed. At the Client end : Data <Block=1 , 0 Bytes. Regards Hervey Bay Qld. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6104 |
Connect to the WEBmite with your terminal program of choice. On the pico, LIST ALL In your terminal program, do whatever you have to do to save the listing. Note: you may have to correct some wordwrap if you have long lines in the listing. Jim VK7JH MMedit MMBasic Help |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6104 |
If you want to persevere with TFTP This is the command I used for MMEdit/MMCC before I incorporated it into MMEdit with my own code. The Windows TFTP wouldn't overwrite existing files on the PC which is a pain so I rolled my own. The Linux commandline: tftp -m binary %IP% -c get %RemoteFile% %LocalFile% %IP% etc are replaced with the relevant values. Jim VK7JH MMedit MMBasic Help |
||||
Dinosaur Guru Joined: 12/08/2011 Location: AustraliaPosts: 311 |
Hi All Thanks Jim, BUT still the same problem. Thought it may have to with joining 'dialout' group , but to no avail. I would like to persevere as there must be a solution, as I think the problem is with Linux. Have Googled with a lot of results on TFTP 0 length files, but usually to do with permissions. Regards Hervey Bay Qld. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6104 |
Use Wireshark or similar on the Linux PC to see what is happening. There are a few different incarnations of TFTP for Linux and I had to find the best one but that was only to get the command line working from a shell script. Jim VK7JH MMedit MMBasic Help |
||||
TheMonkeys Regular Member Joined: 15/12/2022 Location: AustraliaPosts: 59 |
Hi all, Firstly, permissions. As root, you may need to: chmod 666 /dev/ttyACM0 Secondly, tftp under Linux is pretty limited. Try atftp (apt get atftp) It allows putting/getting from the command line and has tab command and filename completion and command history in interactive mode Thirdly, try (from the command prompt): Save "current.bas" Then grab it using your browser (I have an php script for sending and retrieving a list of files). Cheers, Chris. |
||||
Dinosaur Guru Joined: 12/08/2011 Location: AustraliaPosts: 311 |
Hi All Thanks for that Chris, it would not work until your last suggestion of Save "Myfile.bas" on the Pico, and then running atftp on the Rpi-Zero. Well done, will try to automate that. Many thanks for all the help in this thread. EDIT: Worth Noting that TFTP works as well, as long as you Save "Myfile.bas". Which I believe was the problem all along. But ATFTP is a better choice. Edited 2023-12-06 17:59 by Dinosaur Regards Hervey Bay Qld. |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3819 |
Only do that for testing!! If it's "needed" (i.e. the test works after you do that but didn't work before), you have a problem such as not being a member of group dialout or not having an appropriate udev rule. John |
||||
robert.rozee Guru Joined: 31/12/2012 Location: New ZealandPosts: 2350 |
i've always found it sufficient to do: sudo usermod -a -G DIALOUT $USER and thereafter all serial ports are usable. i run Linux Mint XFCE. if wanting to use xmodem, you might like to give GFXterm a try: https://github.com/robert-rozee/GFXterm/tree/main/binaries GFXterm allows access to xmodem by just pressing F11 (upload) or F12 (download) at the command prompt. these only work with the 'main' basic program, not named files or numbered flash slots. cheers, rob :-) |
||||
Dinosaur Guru Joined: 12/08/2011 Location: AustraliaPosts: 311 |
Hi All I did mention in the posts above that I tried that. What i find more interesting is that each time the Pico replied with "Send Completed" when in fact the client got zero bytes. Yet doing a "Save" solved the problem, indicating to me that the problem was in fact at the Pico end. Was there a zero bytes long file at the location for it to reply with "Send Completed" ? Or is there an unidentified problem that should have replied with "File not found" ? Regards Hervey Bay Qld. |
||||
Page 1 of 2 |
Print this page |