sparxfly wrote:Device reports a timeout waiting for data.
As a test, I copied the files from the zboot subdirectory of the ZBasic installation directory to a temporary directory and edited the file makeboot.bat so that it would build a bootloader for a 16MHz mega328P. As you observed, the resulting bootloader was 982 bytes. Next, I took a blank mega328P and put it in a prototyping board using the 28 pin ZX interface board to supply the serial interface, ATN circuit and 16MHz crystal. I also wired up the ISP SPI signals (+5, gnd, MOSI, MISO, SCK, reset) to a 6-pin header compatible with my device programmer, an Atmel AVRISP.
Using the AVRISP, I set the fuses (ext=FD, hi=D4, lo=D7) and Flashed the
atmega328P_boot.hex file built as described above. Both operations were verified by readback. I then started up the ZBasic IDE with the following content in the SciTEUser.properties file:
Code: Select all
font.monospace=font:Courier New,size:10
font.comment=font:Courier New,size:10,italics
show.target.device.ATmega328P=1
auto.identify=0
target_device=ATmega328P
download.ext=zxb
debug.reset=1
debug.speed=19200
download.speed=115200
debug.comport=2
download.identify=0
download.verify=1
download.clear=1
download.quiet=0
debug.capture=1
atn.idle.positive=0
debug.port.mode=0
atn.period=10
atn.duty=1
download.use.atn.char=0
download.atn.char=4
download.change.speed.atn.char=1
With that configuration, I compiled this program:
Code: Select all
Option DeviceParameter package "PDIP-28"
Option DeviceParameter clockFrequency 16000000
Option DeviceParameter rtcFrequency 500
Option DeviceParameter rtcScale 1
Option DeviceParameter swUartDivisor 8
Option DeviceParameter swUartMinSpeed 300
Option DeviceParameter swUartMaxSpeed 19200
Option DeviceParameter swUartBaseSpeed 2400
Option DeviceParameter timerSpeed1Divisor 1
Option DeviceParameter timerSpeed2Divisor 8
Option DeviceParameter ZBasicBootloader true
Option ConsoleSpeed 19200
Sub Main()
Debug.Print "Hello, world!"
End Sub
After compilation, the program was downloaded successfully and the device responded with the expected output.