Skip to content

analog inputs on PB0-7 for A1[U], A4[U] need an ARef #14

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

Open
bombasticbob opened this issue Oct 15, 2014 · 3 comments
Open

analog inputs on PB0-7 for A1[U], A4[U] need an ARef #14

bombasticbob opened this issue Oct 15, 2014 · 3 comments
Assignees

Comments

@bombasticbob
Copy link
Contributor

the analog inputs for the 128A1[U] need a proper 'ARef' in order to be 100% compatible with the mega2560. The problem is that you would only have 15 inputs this way, as one of them would be a dedicated 'ARef' pin.

The main problem is that, for the 'A' series, differential input with gain cannot choose PB0 through PB7. this may be corrected in a later rev, but according to the docs those bits are 'reserved'. See section 28.17.2 in the 'AU' manual, table 28-15.

'D' and 'E' are not affected.

@bombasticbob bombasticbob self-assigned this Dec 12, 2014
@bombasticbob
Copy link
Contributor Author

The USE_AREF '#define' can be used to provide this. It wil assign the correct bits to the correct register to set up 'whatever' as AREF. This might also mean re-numbering the analog pins [which should still work ok, to be verified]. For example, if A0 is your new 'AREF', then PA1 becomes 'A0'. The code must be able to handle this. If the changes are significant in order to make this happen, then create a new issue specifically for that.

@bombasticbob bombasticbob changed the title analog inputs for 128A1[U] need an ARef analog inputs on PB0-7 for A1[U], A4[U] need an ARef Feb 18, 2017
@bombasticbob
Copy link
Contributor Author

bombasticbob commented Feb 18, 2017

also worth pointing out that the A4 and A1 series are the same in this regard (basically all 'A' series devices). Verified, PB0-7 doesn't work at all when using diff input with gain.

So one solution is to reserve either PB0 or PA0 as 'AREF', make THIS "the default config", and use a large value series resistor wired to [A]VCC plus a filter capacitor to ground (2k would probably do it) for the reference on either PA0 or PB0.

To be compatible with the mega2560 layout, A0 could be re-configured as A15, and the others shifted accordingly (this is currently the way I'm working out the 128A4U layout for Uno compatibility, except it's A11, because A4's config is a lot like D4, with only 4 pins on PB).

This way the default AREF will be at Vcc potential. Default gain would be 1x. Other configurations would still be possible, and the AREF pin can be hard-wired to A15 on the A1[U] layouts, for convenience (or to A11 on the A4[U] layouts, as needed).

@bombasticbob
Copy link
Contributor Author

tested 10k from Vcc to A0 as AREF on 128A1U, saw small voltage drop (reading was 1015 or so using non-AREF code and Vcc/2 and diff input with gain as on other CPUs). Since it drops by about 1%, a value of about 1/5 of that should minimize volt drop while simultaneously making it possible to connect voltage sources to AREF without loading it down too much.

So, will need a 2k series resistor between [A]VCC and PA0 (as AREF), with a capacitor to ground to filter it for noise. AREF can then be connected to external sources safely, provided that the source can handle having the resistor there. If this poses a problem, an op-amp buffer may be needed with a higher impedence pullup resistor.

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

No branches or pull requests

1 participant