-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help with external connection #437
Comments
I recently did something similar and found the current manual to be less than ideal. I wrote up what I learned as a "Getting Started" guide and I would be interested to know if you find it useful. Here, in my fork. |
Thanks for the help file. Now I'm studying the UART. I'm looking for how(where in the code) the TX pin is changing when UART communication in progress. I'm logged the avr_raise_irq with timestamp but I didn't found. TX pin is not changing in the UART communication? |
My impression is that none of the communication peripherals are implemented
at the "hardware" level: they do not change or read I/O pins. I think they
just simulate the internal behaviour of the peripheral to firmware and
provide IRQs to get the data in and out as bytes. That is what I meant by
this in my document: "The serial communication periperals (UART, SPI, TWI)
are different, as transmissions do not modify pin state and reception does
not examine it. Instead, each peripheral has its own IRQs to send and
recieve bytes."
I have not looked at those parts of simavr much, as my interest is in
simulating firmware for control of analogue circuits.
…On Wed, 31 Mar 2021 at 13:59, jsmith173 ***@***.***> wrote:
Thanks for the help file.
Now I'm studying the UART. I'm looking for how(where in the code) the TX
pin is changing when UART communication in progress. I'm logged the
avr_raise_irq with timestamp but I didn't found. TX pin is not changing in
the UART communication?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#437 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APAYEBDMFTADMJ3BNLQJWI3TGMMB3ANCNFSM4ZKY6MKQ>
.
|
But this behaviour can change easily. Or not? |
I think that the simulation of communication peripherals to the pin level was seen as being a low priority. So long as you are free to simulate the other end of the circuit in simavr's style it does not get you much, and simply calling avr_connect_irq() as is done in the examples is much, much simpler. But if you want to use a pre-existing UART simulation it becomes important. My guess is that it would be about 150 lines of code to implement the UART pins. There are files avr_bitbang.* that look like an attempt to do pin-level SPI and they might be a partial model. That code seems not used anywhere, perhaps because it is incomplete. |
Not only what @gatk555 says, but it would also slow down the simulation by a huge amount to try to actally keep all the pins in the state the hardware does, for very little gain. The peripherals outputs the "logical" interesting things out of the peripherals (bytes out of SPI, uart, i2c etc) but I don't see the point in trying to emulate a cycle accurate output pin. |
@jsmith173 iIf your goal is to test Arduino codes using simavr for serial communication, it is better to use PICSimLab directly. Support for Arduino and interfaces with serial signal io (SPI, I2C and UART) are not objectives of the simavr project. PICSimLab uses a modified version of simavr, with support for I2C and SPI signals (master mode only) and Arduino (These changes would never be accepted in a pull request ). Simavr is a great simulator, and i understand @buserror 's reasons for not adding detailed support to peripherals. |
Hi,
I'm trying to use simavr in an external gui. My problem with the external connections. For example: pin change interrupts. How simavr should be notified when an input changes? Which data structure should I update?
The text was updated successfully, but these errors were encountered: