download without ATN/DTR
download without ATN/DTR
Hi Guys
Ive just been playing with the Xbee modules. I have two paired up and I connected one to the com1 tx, rx, atn pins of my zx-128ne, and the other to my pc.
When I powered it all up, i got gibberish through the debug window. Checked all the baud rates and this was all good (all set to 115200). So thought it must be the logic levels, so I toggled the rs232/logic level switch on the zx-128ne and rehooked the xbee up to pins 19 and 20. Hey presto, the serial output started coming through loud and clear.
Now the question... Is it possible to download new program files to the zx using this setup?
I tried keeping the dtr pin on the xbee hooked up to the ATN on zx but no joy.
So I then remembered reading about DTRless downloading, however all of the posts i can find on here seem to refer back to a time when there was not the built in option in the options of the IDE. I tried setting the ATN character to 4 in the IDE menu, but when i try to download it says it not responding, and then i get lots of giberish in the debug window again!
I cant find an app note or thread on how this is performed. Am i missing some documentation?
Cheers
Ben
Ive just been playing with the Xbee modules. I have two paired up and I connected one to the com1 tx, rx, atn pins of my zx-128ne, and the other to my pc.
When I powered it all up, i got gibberish through the debug window. Checked all the baud rates and this was all good (all set to 115200). So thought it must be the logic levels, so I toggled the rs232/logic level switch on the zx-128ne and rehooked the xbee up to pins 19 and 20. Hey presto, the serial output started coming through loud and clear.
Now the question... Is it possible to download new program files to the zx using this setup?
I tried keeping the dtr pin on the xbee hooked up to the ATN on zx but no joy.
So I then remembered reading about DTRless downloading, however all of the posts i can find on here seem to refer back to a time when there was not the built in option in the options of the IDE. I tried setting the ATN character to 4 in the IDE menu, but when i try to download it says it not responding, and then i get lots of giberish in the debug window again!
I cant find an app note or thread on how this is performed. Am i missing some documentation?
Cheers
Ben
I think ive sorted it. Seeing as this solution might only be for VM not native mode, i put the following code in running as a task
This seems to do the trick, and i can invoke a download withought the DTR.
However. I can't seem to get this to work in FastMode so am I limited to using 19200 baud all the time? or can i get it to work in 115200?
Ben
Code: Select all
Public Sub cmdmodeTASK()
If (GetQueueCount(CByteArray(Register.RxQueue)) > 0) Then
tempbyte = Console.Read()
if tempbyte = &H04 Then
ZXCmdMode(True)
end if
End If
End Sub
This seems to do the trick, and i can invoke a download withought the DTR.
However. I can't seem to get this to work in FastMode so am I limited to using 19200 baud all the time? or can i get it to work in 115200?
Ben
That is likely because the XBee has a non-inverted serial interface. Also, I believe that the XBee output is 3.3V so communication may not be completely reliable. Moreover, not all XBee devices have 5 volt tolerant inputs. You should check the specifications of the device that you have.sturgessb wrote:I toggled the rs232/logic level switch on the zx-128ne and [...] the serial output started coming through loud and clear.
It may be that it can't keep up with the rate at which DTR is toggled. Some Ethernet-to-serial devices have the same problem. I've been experimenting with a Lantronix UDS1100 device that can download with DTR to native mode devices but not to VM devices. The timing for native mode devices is more relaxed than it is currently for VM devices.sturgessb wrote:I tried keeping the dtr pin on the xbee hooked up to the ATN on zx but no joy.
The "ATN character" works for both VM and native mode devices. The Persistent Memory address for the ATN character is the same (&H13) in both types of devices as well. Of course, you have to first download the program that sets the ATN character before you can download without using DTR.sturgessb wrote:Seeing as this solution might only be for VM not native mode
I assume by this you mean calling ZXCmdMode() with a True parameter. Downloading is always done at 115.2K baud irrespective of the state of that parameter. The IDE's downloading procedure expects ZXCmdMode to be called with a False parameter because it attempts to communicate with the device initially at the standard speed.sturgessb wrote:I can't seem to get this to work in FastMode
- Don Kinzer
Don
The xbee im using says it has 5v friendly inputs so i think im ok on that.
I did try to use the ATN character in that address, and I did first download that in the conventional way, but still no joy. The only way i can get it working is with the additional task
you said that ' Downloading is always done at 115.2K ' but in the sysref manual it states ... 'if your application detects receipt of an “ATN character” and
then invokes ZXCmdMode() in slow speed mode, you can use the ZLoad command line utility or the
ZBasic IDE to perform downloading without needing to have DTR connected to the device.'.... Which to me implies downloading happens at 19.2k?
If it is 115,200 then I dont really understand a) why its not working, and b) what I have to do in order to keep comms at 115.2k and allow DTR less download.
Cheers
Ben
The xbee im using says it has 5v friendly inputs so i think im ok on that.
I did try to use the ATN character in that address, and I did first download that in the conventional way, but still no joy. The only way i can get it working is with the additional task
you said that ' Downloading is always done at 115.2K ' but in the sysref manual it states ... 'if your application detects receipt of an “ATN character” and
then invokes ZXCmdMode() in slow speed mode, you can use the ZLoad command line utility or the
ZBasic IDE to perform downloading without needing to have DTR connected to the device.'.... Which to me implies downloading happens at 19.2k?
If it is 115,200 then I dont really understand a) why its not working, and b) what I have to do in order to keep comms at 115.2k and allow DTR less download.
Cheers
Ben
The statement implies that some communication occurs at 19.2K but it doesn't say, that the downloading occurs at any particular speed.sturgessb wrote:Which to me implies downloading happens at 19.2k?
It doesn't work when you invoke ZXCmdMode() with a True parameter because the IDE expects the device to initially be at the slow speed. If it is not, then the IDE can't talk to the device to perform the download sequence (which includes, by the way, switching to high speed before commencing the download)sturgessb wrote:I dont really understand a) why its not working,
Is it that you also want serial communication with the device to be at 115.2K when you're not downloading?sturgessb wrote: and b) what I have to do in order to keep comms at 115.2k and allow DTR less download.
- Don Kinzer
There was an issue with the process of changing the comm channel speed to perform the downloading and then restoring it. I believe that we've corrected the problem. You can try this experimental version v1.4.7 of the IDE. To use it, just extract the contents of the .zip file to the IDE subdirectory of the ZBasic installation directory (usually /Program Files/ZBasic/IDE). You might rename the existing ZBasicIDE.exe just in case you might want to revert to the previously installed version.sturgessb wrote:Yes I would like normal comms to be at 115.2k also.
- Don Kinzer
Odd, that. It works flawlessly here. I'm using the program below with the Serial Port Options of Port Speed=115200, 'Use ATN character' checked, and 'ATN Character' set to &H04. It is imperative that the parameter to ZXCmdMode() be False.sturgessb wrote:still only works when set to 19200. double and triple checked it.
What version number do you see when you invoke Help | About ZBasic IDE
Code: Select all
Option SignOn Off
Dim atnChar as Persistent Byte Based &H0013
#if Option.TargetCode = "Native"
Private Const stackSize as Integer = 200
#else
Private Const stackSize as Integer = 50
#endif
Private Const cmdChar as Byte = &H04
Private taskStack(1 to stackSize) as Byte
'#define PERS_ATN
Sub Main()
#if defined(PERS_ATN)
atnChar = cmdChar
#else
atnChar = 0
#endif
Call CloseCom(1, 0, 0)
Call OpenCom(1, 115200, CByteArray(Register.RxQueue), CByteArray(Register.TxQueue))
#if NOT defined(PERS_ATN)
' launch the ATN detection task
CallTask cmdTask, taskStack
#endif
Debug.Print "Hello, world!"
End Sub
Sub cmdTask()
Do
If (StatusQueue(CByteArray(Register.RxQueue))) Then
Dim c as Byte
Call GetQueue(CByteArray(Register.RxQueue), c, 1)
If (c = cmdChar) Then
Call ZXCmdMode(False)
End If
End If
Call Sleep(0)
Loop
End Sub
- Don Kinzer