Running Arduino code in the computer

Hello,

I'm working on an Arduino project that interfaces to peripherals through I2C, UART, SPI, digital and analog pins. At this state of the development, a PCB has been designed to integrate all the peripherals, and the Arduino (due) on a single board.

I'm realising that the best way to debug the code is to run it on the computer and use the Arduino as a slave to perform the actual IO operations. I know, there will be delays, and that the Arduino serial communication throughput is limited, but that's ok as I'm not doing anything outside the constraints of the serial port.

As I would rather try to avoid reinventing the wheel, I thought it would be a good idea to ask here if there is any project that does what I need.

Thanks

The best way to debug it would be to use an Arduino with a breadboard and all the peripherals wired up to verify the operation before putting it all onto a PCB.

blh64: The best way to debug it would be to use an Arduino with a breadboard and all the peripherals wired up to verify the operation before putting it all onto a PCB.

I'm past that phase, and yes, thats exactly how it was done, we wired stuff on arduino, tested it and the integrated it on te PCB. The debugging I need to do is more related to program logic.

What you need is a simulator (Atmel Studio has one built in). However you would need to provide external stimuli in a separate file, there is no way that i know of to simulate with hardware in the loop.

Yeah, I thought about that approach as well, to implement some Arduino functions that behave in a similar to the real thing way. But it would take much more effort to make them behave similar to how the peripherals would behave. Adding the hardware to the loop would probably be simpler and more realistic.

I thought someone could have done something like this, I tried to google it, but it was hard to describe the project to the search engine. So I ended up asking in this forum. If no one knows of a project that does this I guess I'll have to code it.

Like this?

AWOL: Like this?

Yes, something like that! But it would be nice if values could be read back, the comm protocol was more efficient (binary), and spi, i2c, and uart were also supported. I suppose what I'm looking for does not exist, and I'll just have to code it myself...