V2.0 - DTR-less downloading
V2.0 - DTR-less downloading
Thanks very much for the great new release. The new zx24a VM is running newly re-compiled code for my large multi-tasking application with dynamic task stack allocation just as the prior version did. I did get errors on task stack sizes - most needed to be a few bytes larger according to the v2.0 compiler. No other issues.
The release notes mentioned DTR-less downloading. I haven't yet found mention of that in the new docs.
thanks again
steve
The release notes mentioned DTR-less downloading. I haven't yet found mention of that in the new docs.
thanks again
steve
Re: V2.0 - DTR-less downloading
We have made the initial changes to support downloading without using the DTR signal but this capability has not yet been tested thoroughly.stevech wrote:The release notes mentioned DTR-less downloading. I haven't yet found mention of that in the new docs.
The idea is that you choose a special character code, in the range &H00 to &H1f, that you want to use as the "ATN character". If the ZX receives this character on Com1, it interprets it as an ATN request and responds the same as if it had received the ATN sequence on the DTR line. Note that when configured for an ATN character, a ZX will still respond to the ATN protocol on the DTR line. Of course, you must choose the ATN character carefully - one that will not otherwise be sent to your ZX on Com1.
The IDE does not yet have the ability to be configured to use an ATN character nor can it configure the ZX for the chosen ATN character. However, if you want to experiment with this you can use ZLoad to do both. An example of the command to configure the ATN character is:
Code: Select all
zload -zb:19:27
Once the ZX is configured for the desired ATN character, you can download code without using DTR by using the ZLoad command line like:
Code: Select all
zload -a27 -v -m test.zxb
For both ZLoad commands, the values may be specified in decimal as shown above or they may be specified in hexadecimal by using a 0x prefix. To disable the ATN character, simply set it back to &Hff:
Code: Select all
zload -zb:19:0xff
- Don Kinzer
I think this is going to require a little more sophistication as the probability of any single character appearing in the datastream is fairly high and may not be under the programmer's control. As Don knows, I encountered this when testing a prerelease version of the VM. He had inadvertently configured the ZX-40a he sent me to use this feature and code that had been working fine with the earlier VM would occasionally cause my app to freeze. Seeing characters that indicated the chip was in command mode was the only thing that finally tipped us off that this might be the cause.
I would suggest bracketing this special character with <DLE>. A sequence like <DLE><ESC><DLE> would be far less likely to happen by chance.
In my case I am transferring memory images of single precision values and have no control over the datastream. I don't recall exactly what triggered it but I was transferring longitude/latitude values.
I would suggest bracketing this special character with <DLE>. A sequence like <DLE><ESC><DLE> would be far less likely to happen by chance.
In my case I am transferring memory images of single precision values and have no control over the datastream. I don't recall exactly what triggered it but I was transferring longitude/latitude values.
Although it can't be used in all circumstances, it does have the virtue of simplicity. A multi-character sequence also will not work in all circumstances (although, clearly the set is larger) but it has some prickly problems that don't have good solutions. For example, what happens if the first two characters are received and then no more characters are received for a long period of time? How long do you wait before you decide to reset the pattern matching state and pass the first two characters on to the application as should clearly be done? Even if a good answer can be established for this question, the question remains as to how to implement the timeout without unduly taxing other parts of the system.dlh wrote:I think this is going to require a little more sophistication [...]. A sequence like <DLE><ESC><DLE> would be far less likely to happen by chance.
As a side note, in the current implementation, the ATN character will never appear in the input queue for Com1 because it is always intercepted.
- Don Kinzer
I don't see that this is all that different from a modem which requires both DATA and COMMAND modes. DLE (Data Link Escape, 0x10) is used with modems for just this purpose. If the byte between two DLEs is always interpreted as a command, there's no need to wait any significant amount of time for the closing <DLE> as it will always follow immediately if the sequence is intended as a command. There may be cases where <DLE><ESC><DLE> occurs as data but they should be rare. For that matter, the amount of time to wait could also be a programmer determined parameter.
The ATIS (Alliance for Telecommunications Industry Solutions) definition of <DLE> is...
data link escape character (DLE): A transmission control character that changes the meaning of a limited number of contiguously following characters or coded representations
The ATIS (Alliance for Telecommunications Industry Solutions) definition of <DLE> is...
data link escape character (DLE): A transmission control character that changes the meaning of a limited number of contiguously following characters or coded representations
V2.0 - DTR-less downloading
> ...I would suggest bracketing this special character with a sequence...
AT-commanded modems do the same with the Escape sequence surrounded by
guard periods.
Tom
AT-commanded modems do the same with the Escape sequence surrounded by
guard periods.
Tom
Tom
For apps that do ASCII only on the serial port (like most of mine), a single char ATN scheme is fine.
I missed the concept of how the scanning for the ATN char is enabled/disabled in the VM. I assume it's disabled by default.
The DLE scheme is OK, but the app has to stuff a second DLE anywhere DLE occurs in real binary data. This is the old IBM BSC protocol for 3270's (I'm dating myself).
I missed the concept of how the scanning for the ATN char is enabled/disabled in the VM. I assume it's disabled by default.
The DLE scheme is OK, but the app has to stuff a second DLE anywhere DLE occurs in real binary data. This is the old IBM BSC protocol for 3270's (I'm dating myself).
Agreed, but as I stated, my app transfers bytes that can fall outside the ASCII range. It may also present problems with TCP/IP connections via the Tibbo EM202 which embeds control characters within the datastream. I think my proposed method is more universal.stevech wrote:For apps that do ASCII only on the serial port (like most of mine), a single char ATN scheme is fine.
If there's a non-zero value at address 19 of persistent memory it defines the ATN character.I missed the concept of how the scanning for the ATN char is enabled/disabled in the VM. I assume it's disabled by default.
Not with a leading and trailing <DLE> as I suggest.The DLE scheme is OK, but the app has to stuff a second DLE anywhere DLE occurs in real binary data.
I think it predates that.This is the old IBM BSC protocol for 3270's
I read recently where komodo dragons date themselves.(I'm dating myself).
It is disabled by default. If you write a ZBasic program to read the byte at address 19 in Persistent Memory, you'll see that it has the value &Hff. The ATN character feature is only active when that address contains a value in the range &H00 to &H1f, which value is the ATN character.stevech wrote:I missed the concept of how the scanning for the ATN char is enabled/disabled in the VM. I assume it's disabled by default.
You can turn it on and off at any time by just writing that byte. This is simpler now using a Based Persistent variable thusly:
Code: Select all
Dim ATNChar as Persistent Byte Based &H0013
Sub Main
ATNChar = &H04 ' set the ATN character to ctrl-D
...
ATNChar = &Hff ' disable the ATN character
End Sub
- Don Kinzer
got it. Thanks.
With this - I can hopefully download via LANs and wireless and so on - things that don't reliably reproduce the original and required DTR timing.
If DTR toggle checking in the VM were done with a concept of much slower and longer periods, less precision required - it would work OK on LANs.
With this - I can hopefully download via LANs and wireless and so on - things that don't reliably reproduce the original and required DTR timing.
If DTR toggle checking in the VM were done with a concept of much slower and longer periods, less precision required - it would work OK on LANs.
Is the ATN char scanning in the mega32 VM too?dkinzer wrote:It is disabled by default. If you write a ZBasic program to read the byte at address 19 in Persistent Memory, you'll see that it has the value &Hff. The ATN character feature is only active when that address contains a value in the range &H00 to &H1f, which value is the ATN character.stevech wrote:I missed the concept of how the scanning for the ATN char is enabled/disabled in the VM. I assume it's disabled by default.
You can turn it on and off at any time by just writing that byte. This is simpler now using a Based Persistent variable thusly:Code: Select all
Dim ATNChar as Persistent Byte Based &H0013 Sub Main ATNChar = &H04 ' set the ATN character to ctrl-D ... ATNChar = &Hff ' disable the ATN character End Sub
Yea!
I downloaded a ZX24 via the new ATN-char mode.
zload -c4 -a4 -v filename.zxb
worked!
The data path is:
Zload -> COM4
COM4 is a virtual COM port driver in XP that goes to the ethernet LAN.
LAN -> WiFi router -> Moxa NPort device (WiFi to serial port bridge)
NPort -> ZX24 module
This data path used to work with the DTR download scheme. But when I moved to a newer/faster PC, for some reason, I could not make downloading work (from the IDE). The IDE debug window did talk to the ZX just fine, but the DTR timing for download stopped working with the new PC. Several things I tried didn't fix it.
Progress!
One of the nice things about this is that the ZX module connected to the W-LAN (or ethernet LAN) can be accessed by any PC, locally or remotely. I could port-forward in my router to give Internet access. No password scheme though. Maybe another argument for letting the application in the ZX invoke the download (assuming it isn't hung up).
I'll try this now with a LANTRONIX WiPort instead of the Moxa NPort. Should work with the XPort too.
Next we'll soon see (I hope!) this ATN-char scheme integrated with the IDE. Meanwhile, I'll just use a .BAT file.
I downloaded a ZX24 via the new ATN-char mode.
zload -c4 -a4 -v filename.zxb
worked!
The data path is:
Zload -> COM4
COM4 is a virtual COM port driver in XP that goes to the ethernet LAN.
LAN -> WiFi router -> Moxa NPort device (WiFi to serial port bridge)
NPort -> ZX24 module
This data path used to work with the DTR download scheme. But when I moved to a newer/faster PC, for some reason, I could not make downloading work (from the IDE). The IDE debug window did talk to the ZX just fine, but the DTR timing for download stopped working with the new PC. Several things I tried didn't fix it.
Progress!
One of the nice things about this is that the ZX module connected to the W-LAN (or ethernet LAN) can be accessed by any PC, locally or remotely. I could port-forward in my router to give Internet access. No password scheme though. Maybe another argument for letting the application in the ZX invoke the download (assuming it isn't hung up).
I'll try this now with a LANTRONIX WiPort instead of the Moxa NPort. Should work with the XPort too.
Next we'll soon see (I hope!) this ATN-char scheme integrated with the IDE. Meanwhile, I'll just use a .BAT file.
Yes, we'll get there. In the mean time, you can configure the IDE to use ZLoad to do the downloading. See the thread about74.html. The third post from the end shows the way to do the configuration. Of course, you'll want to specify slightly different ZLoad options to implement the ATN character method but the means should be clear.stevech wrote:Next we'll soon see (I hope!) this ATN-char scheme integrated with the IDE. Meanwhile, I'll just use a .BAT file.
I assume that you discovered that the -m option in ZLoad causes it to enter monitor mode; hence the disappearing post.
- Don Kinzer