Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:44 27 Nov 2024 Privacy Policy
Jump to

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 : Picomite dropping bytes on autosave

     Page 1 of 2    
Author Message
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 05:49am 09 Nov 2023
Copy link to clipboard 
Print this post

Hi all
Frustrating problem - I'm writing BASIC code in Visual Studio Code, then pasting it to a picomite.

Everything was going well.

Then I upgraded to 5.07.07

All of a sudden, when I paste the code into the picomite it pulls up the following error:

> run
clockodile 2.5
[21] Dim ch=channels, patch(ch
Error : Expected closing bracket

There is definitely a closing bracket. I have confirmed this by pasting the same data to a spare webmite I have. After saving, it returns "Saved 9227 bytes" and runs fine.

After pasting to the fritzed picomite, it returns "Saved 9211 bytes"

Every time, exactly the same error, exactly the same dropped bytes.

Changing connection baud rate returns an identical result.

Upgrading to 5.07.08 beta returns same result.

I have had this before but reinstalling the OS seemed to fix it.

Now I am banging my brick wall against a head.

I'd bin the pico but it has all my stuff soldered to it.

Any suggestions?

Thanks
Joe
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 06:13am 09 Nov 2023
Copy link to clipboard 
Print this post

To be certain the problem isn't at the sending end first paste the code into Notepad and look for errors then copy and paste from Notepad to the Pico via TeraTerm then review with the internal editor.

It seems unusual for the Pico to drop characters, except when lines are too long.

Edit
Set OPTION DISPLAY 60, 160
And see if that helps.
Edited 2023-11-09 16:20 by phil99
 
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 06:22am 09 Nov 2023
Copy link to clipboard 
Print this post

Definitely not in the sending end. The same paste to a webmite compiles perfectly...
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 865
Posted: 06:42am 09 Nov 2023
Copy link to clipboard 
Print this post

Grasping at straws, here but did you "nuke" the Pico prior to loading the firmware?

I ask because I had an unexpected "leftover" on my WeAct H743. I had been running the console @ 460800 baud and then I had reason to reload the firmware. I selected "erase before programming" in STM32-Cube and verified the loading. However, the device somehow retained the 460800 baud for the console, instead of the expected default of 115200.

As if Armmite H7 has access to areas of flash that don't get wiped. Dunno. More of a feature than a fault in this case.
 
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 06:49am 09 Nov 2023
Copy link to clipboard 
Print this post

Hmmm... I experienced the fault, then loaded Picomite_Beta, pressed the little button on the Pi whilst plugging it in, noticed the file "Clear_flash.uf2", and dropped that into the RPI folder. I think. Maybe that file did something untoward.

Then reinstalled the OS - first 5.07.07, then 08, then 06.

Same problem on every version.

  phil99 said  
Edit
Set OPTION DISPLAY 60, 160
And see if that helps.


Thanks, I tried this but same problem. Also tried installing 5.07.06 but same problem. Dropping out at exactly the same place. If I add another byte to the start of the program (a comment symbol), the error moves to a different line, but reliably and repeatably stays there. I think it's time to get my soldering iron, but if anyone has experienced this too and has a fix, or an idea what may be causing it I would like to hear from them.

Is there another way to reset the device to new?


Cheers
Joe
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 865
Posted: 06:59am 09 Nov 2023
Copy link to clipboard 
Print this post

I wouldn't expect "dropping bytes" to be so consistent.

What happens with completely different source?

I had a weird one, using VSC where it appended or omitted some kind of delimiter. It was in one of the settings but this turned me off VSC and I went back to Notepad++.

This was for a different device, however.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 07:06am 09 Nov 2023
Copy link to clipboard 
Print this post

Can the errors be corrected with the internal editor or does that do the same thing?

Perhaps try transferring with XMODEM and see what happens.
 
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 07:18am 09 Nov 2023
Copy link to clipboard 
Print this post

So for the record I've desoldered everything and written another program, this is what happens on the terminal when I autosave it, two bytes have dropped out. Same each time. I'll put this pico aside and start again on another one.

> autosave

print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print"hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "
print "hello "

end
Saved 824 bytes
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6099
Posted: 08:48am 09 Nov 2023
Copy link to clipboard 
Print this post

What terminal program are you using and do you have a line delay configured in the terminal?

Jim
VK7JH
MMedit   MMBasic Help
 
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 09:04am 09 Nov 2023
Copy link to clipboard 
Print this post

CoolTerm on Mac, no line delay, settings as usual, 230400 baud

was working fine

and all working fine on the pico W...
 
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 09:16am 09 Nov 2023
Copy link to clipboard 
Print this post

  PhenixRising said  I wouldn't expect "dropping bytes" to be so consistent.

What happens with completely different source?

I had a weird one, using VSC where it appended or omitted some kind of delimiter. It was in one of the settings but this turned me off VSC and I went back to Notepad++.

This was for a different device, however.


My workflow is to copy the program as text from VSC into the clipboard, type "autosave [ENTER]" into CoolTerm, then paste into CoolTerm. CTRL-Z to save it, then run. It's always worked for me, except in a couple of instances where this exact thing happened... from memory I chucked those Picos, even though a lot of work had gone into soldering hardware to them.

Strange if it hasn't happened to anyone else.
 
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 09:21am 09 Nov 2023
Copy link to clipboard 
Print this post

  phil99 said  Can the errors be corrected with the internal editor or does that do the same thing?

Perhaps try transferring with XMODEM and see what happens.


I didn't even know Picomite has an internal editor! Wouldn't know where to start. CoolTerm is reliable on two other Pico W's so for now I won't try XMODEM for fear of opening another can of spaghetti...
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 11:35am 09 Nov 2023
Copy link to clipboard 
Print this post

In the terminal press F4 to open the saved program in the internal editor, or type EDIT if that doesn't work.
At the bottom of the screen are the navigation keys. F2 saves and runs it.

XMODEM seems to communicate differently to AUTOSAVE so might give a different result, assuming your terminal supports it at that end. The manual shows how to use it at the Pico end.

Might also be worth trying that Pico on a Windows computer to see if it is a Mac thing. I can't recall anyone else having this issue.
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 865
Posted: 12:29pm 09 Nov 2023
Copy link to clipboard 
Print this post

MMC that comes with MMEdit; Right click at the MMC command prompt (source already copied to clipboard) and select Autosave from the pop-up menu. Clipboard is sent to the device and code is ready to run.
 
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 02:08pm 09 Nov 2023
Copy link to clipboard 
Print this post

  phil99 said  In the terminal press F4 to open the saved program in the internal editor, or type EDIT if that doesn't work.
At the bottom of the screen are the navigation keys. F2 saves and runs it.

XMODEM seems to communicate differently to AUTOSAVE so might give a different result, assuming your terminal supports it at that end. The manual shows how to use it at the Pico end.

Might also be worth trying that Pico on a Windows computer to see if it is a Mac thing. I can't recall anyone else having this issue.


Thanks for your response. I gave the editor a crack. I'm not sure I was getting the right thing but it seemed somewhat... tedious compared to doing it on VSC and pasting across.

I'm concluding my computer is good because it works fine on the vast majority of picos that I've programmed (one project I did used around 70, this issue came up once or twice but I was under the pump so I just threw them away and carried on).

Obviously it's not a common fault . Surprised no one else has come across it.

Anyway, thanks all for your help, back to the coal face for me...
 
NPHighview

Senior Member

Joined: 02/09/2020
Location: United States
Posts: 200
Posted: 03:52pm 09 Nov 2023
Copy link to clipboard 
Print this post

I see that problem consistently, which has made my workflow a bit different. I generally first edit on Notepad++ or Atom (both have nice syntax coloring, and use familiar Ctrl-C, Ctrl-V, Ctrl-Z keystrokes), then use XMODEM to transfer the file to the Pico.

At that point, it hardly ever runs correctly first time, so I clean up problems in the built-in editor, exit/save, to a LIST ALL, copy that to the TerraTerm clipboard, and paste it back into the Notepad++ session, and from there up to GitHub.

I would dearly love to have a VSC extension that is:
a) aware of MMBasic syntax, and prompts / colors appropriately
b) an "XMODEM-aware" ability to just send to the Pico from the VSC session
c) It already works with GitHub, so combine b) here with a GitHub update.

I've done a little research on a), but my efforts are pretty meager at this point. My son-in-law, who does professional software development for one of the FAANG companies and is a VSC/GitHub guru, will be visiting us for the holidays this year, so I will twist his arm to help here.
Live in the Future. It's Just Starting Now!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9122
Posted: 04:29pm 09 Nov 2023
Copy link to clipboard 
Print this post

USB can write data faster than the Pico can buffer it. Any decent terminal program that you are pasting into will have configuration to control the rate at which it sends data. Just put a small line delay in (say 5mSec) and the problem should go away.


 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1109
Posted: 04:36pm 09 Nov 2023
Copy link to clipboard 
Print this post

I've had dropped characters while autosaving too, most often when I'm sending lots of CSUB sprite data. I increase the msec/line transmit delay until the problem goes away.
Visit Vegipete's *Mite Library for cool programs.
 
NPHighview

Senior Member

Joined: 02/09/2020
Location: United States
Posts: 200
Posted: 03:15am 10 Nov 2023
Copy link to clipboard 
Print this post

No joy, even with a transmit delay of 5 msec/char. I'll stick with my workflow.
Live in the Future. It's Just Starting Now!
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2350
Posted: 03:54am 10 Nov 2023
Copy link to clipboard 
Print this post

the following may or may not be the cause of your problems...

be sure to set hardware flow control to NONE. the pico also requires that DTR be ASSERTED. this has been an issue since the pico was fist released, and as far as i am aware has not yet been fixed in tinyusb. use google to search for:
pico tinyusb DTR

you could try and find out if your terminal emulator enables asserting DTR manually while hardware flow control is set to NONE. some do, others don't.


cheers,
rob   :-)
 
     Page 1 of 2    
Print this page
© JAQ Software 2024