Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

AVR: UART-signals on UART-pins in circuit

2 posters

Go down  Message [Page 1 of 1]

TimFisch

TimFisch

For education reason, I tried to show the UART signals on the RX/TX pin but i realized, that these signals are missing. At least I was not able to visualize anything on PD0 and PD1 of the atmega328 on a scope (PD0 and PD1 should show RX / TX).

In order to connect 2 MCUs via UART it would be great to enable this connection be set by "drawing a line".

Additionally, instead of the individual serial port for each MCU it would be great to have a individual serial port component with an output. By this it would be a bit more nearer to reality.

https://wiki.mexle.hs-heilbronn.de/

arcachofo

arcachofo

For education reason, I tried to show the UART signals on the RX/TX pin but i realized, that these signals are missing. At least I was not able to visualize anything on PD0 and PD1 of the atmega328 on a scope (PD0 and PD1 should show RX / TX).
As far as i know simavr does not implement uart at the pin level.
PIC mcus have it implemented, if that helps...

With only ome mcu in the circuit , it was not really needed. Now with multi-mcu this is one of the issues that need a solution. And it is still an open question how to implement it:

About inter-mcu communications:
As i see it there are 2 main ways to solve this:
- Realistic: connecting pins and implementing everything at the pin level.
   I see this is needed for educational purposes: watching the actual signals in each pin.
   But can be a little over-killing it, if you only need information flowing.

- High level: Just information transfered (no pins connected, just a "conceptual" connection).
   This is how Serial monitor and Serial port works right now.
   Fast and efficient if you only need communications working.
   Could also be implemented for inter-mcu communication.


I think both modes should be available:
High level mode is the first step planned.
The main issue to solve is the method to connect 2 mcus, like "drawing a line" you mentioned:
In order to connect 2 MCUs via UART it would be great to enable this connection be set by "drawing a line".
This needs to be defined in detail.. how exactly it should work.
My idea is not yet clear, but I was thinking in expanding or adapting the current "Serial Port" component:
Currently you select an mcu uart and a serial port (in your computer).
This could be expanded to select any uart in any mcu in the circuit or serial port in the computer.
So it would be possible any kind of connection betwen mcus or mcu-pc.
It could even be expanded to a generic communication component, not only uart.
So the user could select uart, spi, i2c...


Realistic: mode will take some more time:
Additionally, instead of the individual serial port for each MCU it would be great to have a individual serial port component with an output. By this it would be a bit more nearer to reality.
You mean with output pins to connect to mcu pins? ... like Realistic: mode i mentioned above?

In a broader context:
Currently there is lot of redundant code in mcus: communication modules, adc, eprom,etc. Each simulator: gpsim, simavr and simulide, implements it's own versions. Also each one has it's own event loop and so on.
The idea in the long term is merging all simulators into just one.
Just one event loop, one i2c module, one uart, etc. hopefully increasing efficiency, speed and code simplicity.

So this issue should be solved in that direction.
This means creating an uart module that could be used by all mcus, simulide serial port and any other future component that needs uart.

TimFisch likes this post

TimFisch

TimFisch

A generic communication component sounds interesting, but it separates the simulation a bit more from the "real circuit". On the other hand, I can understand the additional CPU-load for the simulation.

For me, it was kind of strange to see that USART is working, even when the RXD and TXD pins are connected to ground.

The hardware TWI on AVR ist strangely a kind of working on the pin level (so realistic) an also need the pullup resistors to be connected. At least, I see some signals on the scope when using the internal TWI-registers. But I was not able to connect two MCUs and communicate via the TWI registers, up to now.

A (more rough) idea could be to check for a wiring between the serial pins of all MCUs (e.g. RXD, TXD, SCL, SDA, CLK, MISO, MOSI) and whether the corresponding registers are used. When no osci is used on this wiring, no emulation on pin level is needed - so High Level could be used.

To my comment:
Additionally, instead of the individual serial port for each MCU it would be great to have a individual serial port component with an output. By this it would be a bit more nearer to reality.

Currently, one can open a serial port component for each MCU. In a real cicuit, one has to wire RXD and TXD to some other component or input ports of a computer. So, a more realistic thing would be to have an independent serial port component with two pins, which need to be wired to the MCU pins.

https://wiki.mexle.hs-heilbronn.de/

arcachofo

arcachofo

The hardware TWI on AVR ist strangely a kind of working on the pin level (so realistic) an also need the pullup resistors to be connected. At least, I see some signals on the scope when using the internal TWI-registers.  
I implemented an I2C module a few month ago.
This is one step in the line of "integrating everythig" I mentioned before.
It is a generic I2C module that can be used by any component that needs it.
It is used by all I2C devices in simulide and i added it to AVRs too. In the future I will delete gpsim I2C implementation and use this module as well (hopefully).

AVR SPI is working at pin level too, it was implemented by Alexey Popov a few years ago.
AVR PWM, pullups and comparators also needed some work, some done by Alexey.

But I was not able to connect two MCUs and communicate via the TWI registers, up to now.
I will have a look.
Anyway 0.5.15 is now in a very unstable state, there are a few big changes done recently and now there is a lot to test and fix.

A (more rough) idea could be to check for a wiring between the serial pins of all MCUs (e.g. RXD, TXD, SCL, SDA, CLK, MISO, MOSI) and whether the corresponding registers are used. When no osci is used on this wiring, no emulation on pin level is needed - so High Level could be used.
That sounds interesting. I will think about it.

Currently, one can open a serial port component for each MCU. In a real cicuit, one has to wire RXD and TXD to some other component or input ports of a computer. So, a more realistic thing would be to have an independent serial port component with two pins, which need to be wired to the MCU pins.
Ok, now i undertand.

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum