Recent activity
Subscribe to this feed
David Poundall replied on June 26, 2008 08:04 to the problem "Tibbo Lan to serial code needs a reboot to run after power up - Why?" in Tibbo:
T-bone replied on June 26, 2008 07:05 to the problem "Tibbo Lan to serial code needs a reboot to run after power up - Why?" in Tibbo:
David Poundall replied on June 26, 2008 06:45 to the problem "Tibbo Lan to serial code needs a reboot to run after power up - Why?" in Tibbo:
I found that the code does run fine when running in the TIBBO IDE, but has trouble stand alone. Did you drop out of the IDE, power down the unit, power back up again - say 10 seconds later, then try opening the port with whatever application requires the serial port?
I am running ...
TiOS code version ...2.05.01
TIDE ... 2.6.22 Beta Built on March 26th 2008, 18.11.16
I will be getting another unit in the next few days. I will run the same code in that and do another test on the bench. I get around the problem for now by sending the restart comand over the net whenever I lose comms, but I would like to get to the bottom of this one if I can.
Thanks in advance
T-bone replied on June 26, 2008 00:58 to the problem "Tibbo Lan to serial code needs a reboot to run after power up - Why?" in Tibbo:
David Poundall replied on June 25, 2008 10:14 to the problem "Tibbo Lan to serial code needs a reboot to run after power up - Why?" in Tibbo:
Here you go - I am basically using your "net_to_ser_1.tpr" project with a ser.rxclear, and a sock.rxclear just before data is grabbed from buffers.
'***********************************************************************************************************
' THE SIMPLEST DEVICE SERVER (WITHOUT ACTIVE OPENS, WITHOUT BUFFER REDIRECTION)
'***********************************************************************************************************
'This project can run on EM202 and EM1000 platforms. Select platfomr in Project->Settings. If your
'platform is EM1000 then uncomment the code below marked as "EM1000 ONLY". After that do
'Project->Rebuild All.
'***********************************************************************************************************
' This project implements the simplest "serial device server" possible. There is a single TCP
'connection (passive opens only). Once this connection is established, whatever is received
'through TCP is sent out via the serial port and vice versa.
'
' ATTENTION! READ THE COMMENTS IN CODE! YOU MIGHT NEED TO CHANGE THE PROGRAM! For example,
'you may need to set correct IP address, baudrate, etc.
'=============================================================
sub on_sys_init
'This event is always generated first. We use it to setup everything- a socket for TCP
'connection, serial port, etc.
'ATTENTION! Read this code- you might need to do some parameter changes!
dim w as word
dim debug1 as word
'---------- EM1000 ONLY (uncomment if you are using EM1000) ----------
'io.num=PL_IO_NUM_0 'RTS line of serial port 0
'io.enabled=YES 'we configure this line as output
'---------------------------------------------------------------------
net.ip="192.168.1.95" '<<<<<<<<<< IP-address of this device. CHANGE AS NEEDED!
'Next, we request memory for the only socket we need. This is a simple allocation-
'we ASSUME that we have enough memory for what we request.
sock.num=0
sock.rxbuffrq(4) 'we ask for 4*256-16=1008 bytes for the RX buffer of socket 0
sock.txbuffrq(4) 'we ask for 4*256-16=1008 bytes for the TX buffer of socket 0
'Now, we request memory for the serial port. This is a simple allocation- we ASSUME
'that we have enough memory for what we request.
sock.num=0 'Good practice (but, actually, redundant)
ser.rxbuffrq(4) 'we ask for 4*256-16=1008 bytes for the RX buffer of the serial port
ser.txbuffrq(4) 'we ask for 4*256-16=1008 bytes for the TX buffer of the serial port
sys.buffalloc 'And now ACTUAL buffer memory allocation
'We need to setup our socket for TCP/IP.
sock.num=0 'Good practice (but, actually, redundant)
sock.protocol=PL_SOCK_PROTOCOL_TCP 'We set TCP
sock.localportlist="1001" '<<<<<<<<<< Listening ports. CHANGE AS NEEDED!
sock.inconmode = PL_SOCK_INCONMODE_ANY_IP_ANY_PORT 'Accept connection from any host
'Serial port also needs setup (we leave parity and bits/word at default- NO and 8)
ser.num=0 'Good practice (but, actually, redundant)
ser.flowcontrol=DISABLED '<<<<<<<<<< Flow control ON. CHANGE AS NEEDED!
ser.baudrate=ser.div9600 '/4 = We want to run at 38400bps
ser.bits = PL_SER_BB_7
ser.parity = PL_SER_PR_EVEN
ser.enabled=YES 'The serial port is now ON!
'It is nice when your device provides some visual status of what it is doing.
'After we boot, let's play a "power-on" pattern on the LEDs!
pat.play("B-B-B------",YES) 'Blink Red & Green 3 times. <<<<<<<<<< CHANGE IF YOU WISH!
end sub
'=============================================================
sub on_sock_data_arrival
'This event is generated whenever there is an incoming TCP data to process.
'All arriving TCP data is sent out through the serial port.
'You may feel that the code below is a bit cryptic but, actually, it is very simple!
'We use sock.getdata() to extract a portion of data from the socket's RX buffer. We plan
'to put this data into the TX buffer of the serial port. Therefore, we should be mindful
'of the free space in the TX buffer. We only extract as much data from the RX buffer
'of the socket as available free space in the TX buffer of the serial port. This is achieved
'through the use of the ser.txfree property. The ser.setdata() method stores the data into
'the TX buffer of the serial port.
ser.rxclear
ser.setdata(sock.getdata(ser.txfree))
ser.send
end sub
'=============================================================
sub on_ser_data_arrival
'This event is generated whenever there is an incoming serial data to process.
'All arriving TCP data is sent out through the TCP connection.
'The code below is like the code for the on_sock_data_arrival event (see above), only in
'reverse. It copies the data from the RX buffer of the serial port and into the TX buffer
'of the socket.
sock.rxclear
sock.setdata(ser.getdata(sock.txfree))
sock.send
end sub
'=============================================================
sub on_sock_event(newstate as pl_sock_state,newstatesimple as pl_sock_state_simple)
'This event is generated whenever socket status changes. We are only using a single socket (#0) so
'we can be sure that this event is related to it.
'Here is what we do: we don't check the socket state here, we just play a very short
'LED pattern which momentarily dims bot Red and Green LEDs. When this pattern is done playing
'the on_pat event will be generated and we will check socket state there!
pat.play("-",YES)
end sub
'=============================================================
sub on_pat
'This event is generated each time previously loaded LED pattern has finished playing. We load
'new pattern basing on the current state of socket0 connection.
sock.num=0 'Good practice but also redundant for our project
'We just recognize 2 states: connected/not connected
if sock.statesimple=PL_SSTS_EST then
pat.play("GGGGGGGGGGGGGGGG",NO) 'Connection established- Green LED steadily on
else
pat.play("-------------G-G",NO) 'Connection is not established- Green LED double-blinks
end if
end sub
sub on_sock_inband()
' TODO: place "on_sock_inband" event handler code here...
end sub
ezuk replied on June 25, 2008 09:11 to the problem "Tibbo Lan to serial code needs a reboot to run after power up - Why?" in Tibbo:
David Poundall replied on June 20, 2008 09:39 to the discussion "Network UDP broadcast codes - do we have a better list of formats anywhere?" in Tibbo:
OK - Thats cool. Its difficult trying to document a moving target, I am just thankfull that the TiOS responds to the restart command, though why I should need to restart is another matter. If you have any thoughts on this feel free to comment on the other thread I have running. Thanks for getting back to me T-Bone.
T-bone replied on June 20, 2008 09:14 to the discussion "Network UDP broadcast codes - do we have a better list of formats anywhere?" in Tibbo:
David Poundall replied on June 20, 2008 07:37 to the discussion "Network UDP broadcast codes - do we have a better list of formats anywhere?" in Tibbo:
T-bone replied on June 20, 2008 01:01 to the discussion "Network UDP broadcast codes - do we have a better list of formats anywhere?" in Tibbo:
David Poundall started a conversation in Tibbo on June 19, 2008 17:59:
Network UDP broadcast codes - do we have a better list of formats anywhere?Using a packet sniffer I have found that to reboot the DS202 over the network I need to send "_" followed by "[the mac address]" followed by the reboot command "E". Not just The reboot command on its own (as per Tibbo Documentation). The full string being ...
""_[0.202.0.0.158.236]E".
This is the only command that works correctly though. I can't get the version reply by using "V", and "T" only sends me back an "A".
Is the broadcast mode better documented anywhere?
David Poundall replied on June 16, 2008 19:20 to the question "Rebooting the DS202 across the network" in Tibbo:
David Poundall replied on June 16, 2008 19:08 to the question "Rebooting the DS202 across the network" in Tibbo:
David Poundall replied on June 16, 2008 18:29 to the problem "Tibbo Lan to serial code needs a reboot to run after power up - Why?" in Tibbo:
When I say - no joy, the lights flash on the TIBBO as they should (a steady double pulse of the green light). But when Com 2 is opened (as witnessed by a serial port sniffer on the PC) the Tibbo does not switch to a continuous green light indicating port open.
Might it be that the virtual port code is not sending the correct wake up call to the Tibbo? Maybe there is a code revision issue at the PC end?
David Poundall replied on June 15, 2008 09:22 to the problem "Tibbo Lan to serial code needs a reboot to run after power up - Why?" in Tibbo:
Tried that and just retried that. The exact sequence of events was....
0. Load the project
1. Add a dummy line of code to the code.
2. Check and uncheck ( just to be sure) the debug box
3. Upload (but do not restart through tibbo)
4. Remove all cables
5. Power down the tibbo
6. Reconnect all cables
6. Power up the tibbo
7. Try to connect.
No joy. Is there anything else I can try?
ezuk replied on June 15, 2008 07:15 to the problem "Tibbo Lan to serial code needs a reboot to run after power up - Why?" in Tibbo:
David Poundall reported a problem in Tibbo on June 13, 2008 09:20:
Tibbo Lan to serial code needs a reboot to run after power up - Why?Whenever I power up my DS202 I always have to re-boot via the Tibbo IDE for my lan to serial port code in the Tibbo to work correctly. Before I do the re-boot I can see from the icon in Device Explorer that the Tibbo is supposed to be running.
Is there anything that I can code into the Tibbo to guarantee full operation on power up without the need to send a command from the PC?
David Poundall replied on May 19, 2008 13:39 to the question "Rebooting the DS202 across the network" in Tibbo:
ezuk replied on May 19, 2008 11:43 to the question "Rebooting the DS202 across the network" in Tibbo:
spalpeen asked a question in Tibbo on May 16, 2008 10:28:
Rebooting the DS202 across the networkWhen an application hangs and the virtual serial port is left open. Is it possible to perform a reset of the DS202 hardware using TCPIP or UDP. If so what would be the command I would need to use.
Loading Profile...


