simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Simulavr-devel] SerialRX and feedback example


From: Knut Schwichtenberg
Subject: Re: [Simulavr-devel] SerialRX and feedback example
Date: Thu, 09 Apr 2009 22:34:41 +0200
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Okay, now I see your pain.

BUT, attached I have a checkdebug.tcl and that shows what it should! So forget
the AVR-sources so the problem is in the TCL world!

Today it's to late to proceed, tomorrow there is another day!

Knut

Joel Sherrill schrieb:
> Knut Schwichtenberg wrote:
>> Joel Sherrill schrieb:
>>  
>>> Knut Schwichtenberg wrote:
>>>    
>>>> Joel,
>>>>
>>>> back to the roots: If I got you right your problem is that under all
>>>> circumstances your receiver get always "0". And now you are looking
>>>> for reasons.
>>>>
>>>>         
>>> That's the root of the problem.
>>>     
>> Okay, I'm not sure if I get you right:
>> I use the CVS loaded on 27-Mar:
>>
>> make dogdb
>> ../simulavr.tcl -d atmega128 -f feedback -s ./feedback.tcl -W
>> 0x21,/dev/stderr
>> -R 0x22,- -F 4000000 -T exit -S ./simfeedback.tcl -g
>> No connect to socket possible now... retry Connection refused
>> No connect to socket possible now... retry Connection refused
>> User Interface Connection opened by host 127.0.0.1 port 7777
>> Waiting on port 1212 for gdb client to connect...
>> Connection opened by host 0.0.0.0, port -28871.
>> Initialize debug io
>> -uart init--h-h-e-e-l-l-l-l-o-o- - -w-w-o-o-r-r-l-l-d-d-J--O--E--L--
>> ...
>>
>> What I do not understand is the duplicate of characters except if one
>> character
>> is routed to the special pin and one is the real received character.
>>
>>   
> No.  That's just debug IO using the -R/-W port.  Look at
> main.c,  it is mirroring a string to both ports and
> uart_putchar is actually also doing a debug print to the
> -R/-W magic port.
> 
> You are seeing debug IO and thinking it is really going
> out the UART.
>> In the "simfeedback.tcl" window I see
>> ....
>> FDBK RECV: --->set rxD0 L<---
>> FDBK SET: rxD0 ChangeValue L
>> FDBK RECV: --->set serialRx0 0x0<---
>> FDBK SET: serialRx0 ChangeValue 0x0
>> SerialRx: 0x0
>> FDBK RECV: --->set rxD0 H<---
>> FDBK SET: rxD0 ChangeValue H
>> FDBK RECV: --->set rxD0 L<---
>> FDBK SET: rxD0 ChangeValue L
>> FDBK RECV: --->set serialRx0 0x0<---
>> FDBK SET: serialRx0 ChangeValue 0x0
>> SerialRx: 0x0
>> .....
>>
>> Do you talk about the "SerialRx: 0x0"?
>>   
> Yes.  That is the byte assembled by SerialRX and
> handed off via a call to CharReceived() is always 0.
> Clearly the RXD0 pin feeding into SerialRX.
> Given the debug I posted earlier, I don't see how the pin
> changes multiple times without Step ever seeing it.
>>> The SerialRX PinChanged notification routine is showing transitions.
>>> The state change bit sampling logic in Step is just always seeing 0.
>>>     
>>
>> Knut
> Thanks.  Maybe now we are on track.
> --joel
#! /usr/bin/wish
#
###############################################################################
#
# LCD and Serial IO example for simulavrxx
#
# Last modifications:
# 02-Sep-2008 KSchwi previous example LCD extended by Serial Rx / TX
#
###############################################################################
#
#  $Id: checkdebug.tcl.in,v 1.2 2009/03/13 20:37:33 joelsherrill Exp $
#

#
#set traceFile trace

#we use some itcl :-)
package require Itcl

#load the avr-simulator package
load ../../src/.libs/libsimulavr.so
puts "simulavr loaded"

#now start external generic gui server
exec /usr/bin/wish ../gui.tcl &

#start the trace output to given filename
#StartTrace $traceFile

#start the user interface client
set ui [new_UserInterface 7777 ]

#create new device
set dev1 [new_AvrDevice_atmega128]

#load elf file to the device
AvrDevice_Load $dev1 "./feedback"

#set the clock cycle time [ns].  Here ~3.686400 MHz
AvrDevice_SetClockFreq $dev1 250

#systemclock must know that this device will be stepped from application
set sc [GetSystemClock]

#also the gui updates after each cycle
$sc AddAsyncMember $ui

# Serial transmitter and receiver Net
Net ser_rxD0
Net ser_txD0

#create a Pin for serial in and serial out of the LCD-board
ExtPin exttxD0 $Pin_PULLUP $ui "txD0" ".x"
ExtPin extrxD0 $Pin_PULLUP $ui "rxD0" ".x"

#create a serial in and serial out component
SerialRx mysrx $ui "serialRx0" ".x"
SerialRxBasic_SetBaudRate mysrx 9600
SerialTx mystx $ui "serialTx0" ".x"
SerialTxBuffered_SetBaudRate mystx 9600

# wire the serial display receiver
ser_rxD0 Add [AvrDevice_GetPin $dev1 "E1"]
ser_rxD0 Add extrxD0
ser_rxD0 Add [SerialRxBasic_GetPin mysrx "rx"]

# wire the serial display transmitter
ser_txD0 Add [AvrDevice_GetPin $dev1 "E0"]
ser_txD0 Add exttxD0
ser_txD0 Add [SerialTxBuffered_GetPin mystx "tx"]

#create an LCD name mylcd
Lcd mylcd $ui "lcd0" ".x"
$sc AddAsyncMember  mylcd

#Create for the Pins d0 - d4, e, r, c a Net and
#connect the LCD pins to the AVR pins
# "r" = Read / Write
# "c" = command / Data
# "e" = Enable

Net E
E Add [Lcd_GetPin mylcd "e"]
E Add [AvrDevice_GetPin $dev1 "C7"]

Net RW
RW Add [Lcd_GetPin mylcd "r"]
RW Add [AvrDevice_GetPin $dev1 "C6"]

Net CD
CD Add [Lcd_GetPin mylcd "c"]
CD Add [AvrDevice_GetPin $dev1 "C5"]

Net D3
D3 Add [Lcd_GetPin mylcd "d3"]
D3 Add [AvrDevice_GetPin $dev1 "C3"]

Net D2
D2 Add [Lcd_GetPin mylcd "d2"]
D2 Add [AvrDevice_GetPin $dev1 "C2"]

Net D1
D1 Add [Lcd_GetPin mylcd "d1"]
D1 Add [AvrDevice_GetPin $dev1 "C1"]

Net D0
D0 Add [Lcd_GetPin mylcd "d0"]
D0 Add [AvrDevice_GetPin $dev1 "C0"]

#exec xterm -e tail -f $traceFile &

puts "Simulation runs endless, please press CTRL-C to abort"

GdbServer gdb1 $dev1 1212 0
$sc Add gdb1

exec ddd  --debugger avr-gdb --command checkdebug.gdb &
## exec  avr-gdb --command checkdebug.gdb &

#now run simulation
$sc Endless


reply via email to

[Prev in Thread] Current Thread [Next in Thread]