Software UART Recieve only on AVR

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

 

I am encountering a memory leak of some sorts (Proabbly from arduino String) so I am doing a total code overhaul on my avr.

ATMEGA644PA@ 5V,16MHz

 

This means getting rid of all my Arduino dependencies and porting the libraries over to more efficient versions.

One big problem I see is an implementation of Software UART on an interrupt pin. For me its PB2.

http://gammon.com.au/Arduino/ReceiveOnlySoftwareSerial.zip

The reason I use this is because my other UARTs are in use.

I've been using this library to do the trick, so I know it is possible. But it requires a pins_arduino.h file to map all my avr pins to something what an arduino would use and the arduino core..

I've tried researching the projects section for avr software uart code but I don't understand any of them.

From what I've seen, it is just an ISR routine that reads in the RX from a serial UARTdevice.

However, I am new to programming an AVR and sort of need a push in the right direction on how to implement this.

Basically I want the same code functionality without that darn Arduino garbage!

Right now I am attempting to adjust thelibrary by mostly hardcoding it for my application.

Just wondering if there is a simple way to do this.

 

 

 

Last Edited: Sat. Jun 29, 2019 - 02:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1: I would expect to see USART0 transmit one byte (hex FF)
2: The external interrupt INT2 on PB2 is not enabled (EICRA and EIMSK)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Weirdly enough I do not see any ISR's for INT2 in this library's.c file.

 

They do through PCINT's

 

ISR(PCINT0_vect)
{
  ReceiveOnlySoftwareSerial::handle_interrupt();
}
#endif

#if defined(PCINT1_vect)
ISR(PCINT1_vect)
{
  ReceiveOnlySoftwareSerial::handle_interrupt();
}
#endif

#if defined(PCINT2_vect)
ISR(PCINT2_vect)
{
  ReceiveOnlySoftwareSerial::handle_interrupt();
}
#endif

#if defined(PCINT3_vect)
ISR(PCINT3_vect)
{
  ReceiveOnlySoftwareSerial::handle_interrupt();
}

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm confused you talk about: title is  receive only , but your link is to transmit only !

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That code is not what you originally put in post #1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I edited post 1. The link I just posted is the correct link. I ended copying the wrong git link.