8
\$\begingroup\$

I found very nice open source avr emulator (this one.) Since there is uart emulation implemented it can simulate Arduino.

I have some problems with the "board_simduino" example.

I hooked up virtual leds to port B (pins 8-13) - http://gitorious.org/~viroos/simavr/viroos-simduino-simavr/commit/bfaeac1e61f1d6678b3daab7fede9a783d01c098, and they work.

But serial connection looks broken. I can upload sketch (I added ,link=/dev/ttyUSB0 to socat command for that), but after that communication stops working. For example I can upload "physical pixel" sketch but I can't turn on leds. I tried to connect using serial monitor in buily in IDE and from pySerial. It looks like commends are being ignored.

Also in "blink" sketch in the main loop:

void loop()
{
 digitalWrite(ledPin, HIGH); // set the LED on
 delay(1000); // wait for a second
 digitalWrite(ledPin, LOW); // set the LED off
 delay(1000); // wait for a second
}"

I have to remove delay(1000); command because they hang the emulator.

I will appreciate any help. Most important form me for now is uart fixing (run "physical pixel" sketch.)

JRE
75k10 gold badges115 silver badges197 bronze badges
asked Feb 24, 2010 at 1:32
\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

While I haven't use a hardware simulator for a while, it think what s happen is something like this.

Each clock cycle of the AVR is simulated which takes multiple clock cycles on the host PC. Hence time on the simulated AVR is running slower than real time. This could explain why the delay loop would appear to hang the AVR simulator.

A similar scenario could be the case with the serial port.

Personally, I'm not sure if the simulating modern processors with flash memory is productive as it's quicker to just load the program into the system and "let it run" to see what happens.

answered Mar 22, 2010 at 4:07
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.