Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | BasicX | BasicX 24 Chip Hangs When USB-to-Serial cable unplugged then plugged back in.


Advertise Here

Discussion forum for the BasicX family of microcontroller chips.

BasicX 24 Chip Hangs When USB-to-Serial cable unplugged then plugged back in. - trevio2100 - Apr 14 2:18:21 2009

Hi,

The BasicX 24 Chip Hangs When a USB-to-Serial cable is unplugged then plugged back in. I have created a simple version of code to re-create the issue.

The following basicx code will open the COM1 serial port. It will then flash a light on and off on PIN 5 while the code is looping. The code is downloaded to my BX24 Chip (hosted on a BX24 Development Station) via a USB-to-Serial cable. The code executes correctly because the light flashes on and off. When the USB-to-Serial cable is unplugged the code will continue to execute correctly (the light will continue to flash on/off). After waiting 10 seconds, I plug the USB-to-Serial cable back into my laptop the light will stop flashing. ie. the program hangs.

I would like to know if there is any way to avoid this crash other than using the WatchDog commands.
-----------------------------------
Option Explicit

Dim InputBuffer(1 To 34) As Byte ' 14-byte buffer.
Dim OutputBuffer(1 To 10) As Byte ' 1-byte buffer.

Public Sub Main()

Call OpenSerialPort(1,19200)
dim count as byte

'HACK: reset timer reset after 2 seconds of inactivity
'Call OpenWatchDog(7)

count = 0
do
'Call Watchdog() HACK
count = count + 1

if(count=2) then
Call PutPin(5, bxOutPutLow)
count = 0
else
Call PutPin(5, bxOutPutHigh)

end if

call delay(1.0)
loop

End Sub
Sub OpenSerialPort(ByVal PortNumber As Byte, ByVal BaudRate As Long)

Call OpenQueue(InputBuffer, 34)
Call OpenQueue(OutputBuffer, 10)
Call OpenCom(PortNumber, BaudRate, InputBuffer, OutputBuffer)
End Sub

------------------------------------



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


Re: BasicX 24 Chip Hangs When USB-to-Serial cable unplugged then plugged back in. - Tom Becker - Apr 14 11:15:45 2009

> ... when a USB-to-Serial cable is unplugged then plugged back in...

My guess is that the action simulates ATN and the processor module goes
into IDE control mode. If you have the IDE running when you do that,
try clicking the Execute icon to see if it then starts running. If so,
a fix might be to put a pullup resistor (1k - 100k) on pin 4.
Tom
------------------------------------



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )