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

Support other microcontrollers than ATmega328p #5

Open
rmeister opened this Issue Aug 16, 2016 · 9 comments

Comments

Projects
None yet
4 participants
@rmeister
Contributor

rmeister commented Aug 16, 2016

e.g. ATtiny85, ATmega32u4.

We already began doing some stuff in this direction: publiclab/webjack#17

I managed to get the library sending on the ATtiny with Timer0. The problem with receiving is, that Timer0 uses the same pins as the analog comparator.

A solution could be the ADC multiplexer, which allows to replace AIN1 with an arbitrary ADC input pin. The downside of this solution is, that none of the other ADC pins can be used then, as the ADC has to be disabled.
It would be perfect if Timer1 can be used instead of Timer0. But I did not have the time yet to look closely at the differences between the timers.

For the ATmega32u4 the ADC definitively has to be switched off, otherwise it can only use the internal bandgap reference as negative comparator input.

@arms22

This comment has been minimized.

Show comment
Hide comment
@arms22

arms22 Aug 18, 2016

Owner

Would you like to add a transistor?
like this
http://cyberworks.cocolog-nifty.com/blog/files/modem_mono.pdf

Owner

arms22 commented Aug 18, 2016

Would you like to add a transistor?
like this
http://cyberworks.cocolog-nifty.com/blog/files/modem_mono.pdf

@rmeister

This comment has been minimized.

Show comment
Hide comment
@rmeister

rmeister Aug 18, 2016

Contributor

I think I did not understand your question. Will a transistor help in supporting other µCs?

Contributor

rmeister commented Aug 18, 2016

I think I did not understand your question. Will a transistor help in supporting other µCs?

@arms22

This comment has been minimized.

Show comment
Hide comment
@arms22

arms22 Aug 19, 2016

Owner

Yes. An analog comparator becomes unnecessary.
There should be an interrupt pin for reception and a general-purpose pin for transmissions.

Owner

arms22 commented Aug 19, 2016

Yes. An analog comparator becomes unnecessary.
There should be an interrupt pin for reception and a general-purpose pin for transmissions.

@rmeister

This comment has been minimized.

Show comment
Hide comment
@rmeister

rmeister Aug 22, 2016

Contributor

Ah I see, thanks for the hint. This circuit also has the benefit that it does not need a pin for reference voltage. Would be great to get this working, hope I can build the circuit this week.

Unfortunately there is also a downside: this will break compatibility with existing shields/boards ( I could not find any with transistor built-in). Meaning this probably would require some documentation and a new major release.

Contributor

rmeister commented Aug 22, 2016

Ah I see, thanks for the hint. This circuit also has the benefit that it does not need a pin for reference voltage. Would be great to get this working, hope I can build the circuit this week.

Unfortunately there is also a downside: this will break compatibility with existing shields/boards ( I could not find any with transistor built-in). Meaning this probably would require some documentation and a new major release.

@jywarren

This comment has been minimized.

Show comment
Hide comment
@jywarren

jywarren Nov 27, 2016

I got SoftModem onto the Leonardo (ATmega32u4), and sending, but not receiving (as noted) using @rmeister's https://github.com/rmeister/SoftModem/tree/attiny-support.

What would it take to get receiving working? I'd like to contribute but am not sure exactly where to start. Thank you!

jywarren commented Nov 27, 2016

I got SoftModem onto the Leonardo (ATmega32u4), and sending, but not receiving (as noted) using @rmeister's https://github.com/rmeister/SoftModem/tree/attiny-support.

What would it take to get receiving working? I'd like to contribute but am not sure exactly where to start. Thank you!

@arms22

This comment has been minimized.

Show comment
Hide comment
@arms22

arms22 Dec 2, 2016

Owner

I think that additional circuitry is necessary to support SoftModem.

#5 (comment)

Owner

arms22 commented Dec 2, 2016

I think that additional circuitry is necessary to support SoftModem.

#5 (comment)

@arms22

This comment has been minimized.

Show comment
Hide comment
@arms22

arms22 Dec 2, 2016

Owner

ATmega32U4 has Analog Comparator.

AIN+ can be connected either to the AIN0 (PE6) pin, or to the internal
Bandgap reference. AIN- can only be connected to the ADC multiplexer.

If analogRead is unnecessary, make the following connection.
AIN+ AIN0
AIN- AIN1

If you need analogRead, make the following connection.
AIN+ AIN0
AIN- Bandgap ref

For more detail see 2.3 Analog Comparator
http://www.atmel.com/ja/jp/Images/Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Datasheet.pdf

Owner

arms22 commented Dec 2, 2016

ATmega32U4 has Analog Comparator.

AIN+ can be connected either to the AIN0 (PE6) pin, or to the internal
Bandgap reference. AIN- can only be connected to the ADC multiplexer.

If analogRead is unnecessary, make the following connection.
AIN+ AIN0
AIN- AIN1

If you need analogRead, make the following connection.
AIN+ AIN0
AIN- Bandgap ref

For more detail see 2.3 Analog Comparator
http://www.atmel.com/ja/jp/Images/Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Datasheet.pdf

@jywarren

This comment has been minimized.

Show comment
Hide comment
@jywarren

jywarren Dec 5, 2016

Thanks! I'm not familiar enough with electronics to help on a circuitry change at this point, but I looked up what an analog comparator is, which was a good first step for me:

http://www.instructables.com/id/Girino-Fast-Arduino-Oscilloscope/step11/How-the-Analog-Comparator-works/

jywarren commented Dec 5, 2016

Thanks! I'm not familiar enough with electronics to help on a circuitry change at this point, but I looked up what an analog comparator is, which was a good first step for me:

http://www.instructables.com/id/Girino-Fast-Arduino-Oscilloscope/step11/How-the-Analog-Comparator-works/

@gyunaev

This comment has been minimized.

Show comment
Hide comment
@gyunaev

gyunaev Jan 30, 2017

Just wanted to let you know that I have implemented the circuit shown above http://cyberworks.cocolog-nifty.com/blog/files/modem_mono.pdf and it worked fine on Atmega328. The only exception is that a 100R resistor was replaced by 1K resistor. Analog comparator interrupt handler is replaced by a regular interrupt triggered on RISING.

However SoftModem currently does not work on attiny85, at least on 16Mhz using internal PLL oscillator. Sending kind of works after I replaced timer output with manual port switching and _delay_us(), but with sync errors: sending anything longer than five characters is impossible as the sequence gets corrupted. With default timers it doesn't work at all, even though it sounds like normal. And receiving doesn't work at all, even though the same softmodem works on 328P (with transistor).

gyunaev commented Jan 30, 2017

Just wanted to let you know that I have implemented the circuit shown above http://cyberworks.cocolog-nifty.com/blog/files/modem_mono.pdf and it worked fine on Atmega328. The only exception is that a 100R resistor was replaced by 1K resistor. Analog comparator interrupt handler is replaced by a regular interrupt triggered on RISING.

However SoftModem currently does not work on attiny85, at least on 16Mhz using internal PLL oscillator. Sending kind of works after I replaced timer output with manual port switching and _delay_us(), but with sync errors: sending anything longer than five characters is impossible as the sequence gets corrupted. With default timers it doesn't work at all, even though it sounds like normal. And receiving doesn't work at all, even though the same softmodem works on 328P (with transistor).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment