Thanks I see no difference in the contents, must be something else going on.
Lefty
Thanks I see no difference in the contents, must be something else going on.
Lefty
So in summation of problems addressing analog input pins of bobuino varieant board, there seems to be two
different symptoms:
If using analogRead() addressing names of 0 to 7 see a symmetrical reversal to 7 to 0.
If using analogRead() addressing names of A0 to A7 or 14 to 21 get:
sketch software pin name used valid voltage reading shows up on shield pin
A0 (or14) A1 (15)
A1 (or15) A0 (14)
A2 (or16) A7 (21)
A3 (or17) A6 (20)
A4 (or18) A5 (19)
A5 (or19) A4 (18)
A6 (or20) A3 (17)
A7 (or21) A2 (16)
Strange stuff, no?
Lefty
At least we're making some progress, as it's not just a dream I had.
Mine work in perfect order for "both" 0..7 and A0.., although I'm using a loop on A0...,
so I don't know what the problem is over there. ??? I'm not using Bob's board, just connecting
directly to the pins.
Here is my current test. I compiled the code with the Bobuino arduino_pins.h file
patched as I indicated above. All ADC Channels are floating here, and I am moving a
gnd wire from pin to pin after each set of readings, starting at 33 [AD0]. You
see the zero reading follows along exactly correctly.
My entire sketch is included below.
A0..A7: 0 301 275 290 320 352 360 602
0...7: 0 152 226 272 313 362 365 479
A0..A7: 419 0 138 232 308 384 400 425
0...7: 403 0 103 181 229 261 272 275
A0..A7: 420 428 0 123 243 309 323 304
0...7: 305 319 0 97 166 191 210 254
A0..A7: 306 319 295 0 111 211 266 308
0...7: 339 351 338 0 136 243 307 385
A0..A7: 398 392 360 345 0 166 262 379
0...7: 396 398 382 375 0 149 240 338
A0..A7: 360 370 351 343 346 0 169 271
0...7: 317 338 336 332 335 0 121 204
A0..A7: 370 381 361 348 357 356 0 154
0...7: 235 282 292 294 305 312 0 111
A0..A7: 146 257 306 351 393 476 443 0
0...7: 95 183 227 255 279 295 296 0
A0..A7: 125 223 252 269 293 311 312 0
0...7: 104 196 235 260 286 313 321 0
/**********************************************************
file: analog_test1284
revised: 01/22/13, orig 01/21/13.
Tests Bobuino-1284 ADC channels.
***********************************************************/
/*****************************************/
void setup()
{
Serial.begin(57600);
Serial.println("\n1284 Analog Test ...");
a_print("defines: A0=",A0);
a_print(", A7=",A7);
}
/******************************************/
void a_print( char *s, int num )
{
Serial.print(s); Serial.print(num);
}
/*****************************************************/
void loop()
{
test_adc();
}
#define INTV 5000 // ADC repeat interval.
/**************************************************/
void test_adc()
{
static unsigned long prev=0; // last time LED was updated
unsigned long current=millis();
static int cnt=0;
int i, val=0;
if( (current - prev) > INTV) {
prev = current; // schedule next tick.
nl();
Serial.print("A0..A7: ");
for( i=0; i<8; i++) {
val = analogRead(A0+i);
// val = analogRead(A0+i);
a_print(" ",val);
delay(100);
}
nl();
Serial.print(" 0...7: ");
for( i=0; i<8; i++) {
val = analogRead(i);
// val = analogRead(i);
a_print(" ",val);
delay(100);
}
}
}
void nl() { Serial.println(""); }
Was wiring_analog.c updated from 1.0 to 1.01, .02, .03?
Wondering when the 1284 support came in.
AAMOF, I had already looked at that, but must have been in 1.0 only. However, my sketch
from last time gives me exactly the same results with both IDE 1.0 and 1.03. Likewise
for ERW 1.03. Go figure.
Have you tried running my sketch from last time? Maybe something is weird there.
IDE 1.0
int analogRead(uint8_t pin)
{
uint8_t low, high;#if defined(AVR_ATmega1280) || defined(AVR_ATmega2560)
if (pin >= 54) pin -= 54; // allow for channel or pin numbers
#elif defined(AVR_ATmega32U4)
if (pin >= 18) pin -= 18; // allow for channel or pin numbers
#else
if (pin >= 14) pin -= 14; // allow for channel or pin numbers
#endif
IDE 1.02
int analogRead(uint8_t pin)
{
uint8_t low, high;#if defined(AVR_ATmega1280) || defined(AVR_ATmega2560)
if (pin >= 54) pin -= 54; // allow for channel or pin numbers
#elif defined(AVR_ATmega32U4)
if (pin >= 18) pin -= 18; // allow for channel or pin numbers
#elif defined(AVR_ATmega1284P) || defined(AVR_ATmega644P)
if (pin >= 24) pin -= 24; // allow for channel or pin numbers
#else
if (pin >= 14) pin -= 14; // allow for channel or pin numbers
#endif
IDE 1.03
int analogRead(uint8_t pin)
{
uint8_t low, high;#if defined(AVR_ATmega1280) || defined(AVR_ATmega2560)
if (pin >= 54) pin -= 54; // allow for channel or pin numbers
#elif defined(AVR_ATmega32U4)
if (pin >= 18) pin -= 18; // allow for channel or pin numbers
#elif defined(AVR_ATmega1284P) || defined(AVR_ATmega644P)
if (pin >= 24) pin -= 24; // allow for channel or pin numbers
#else
if (pin >= 14) pin -= 14; // allow for channel or pin numbers
#endif
Have you tried running my sketch from last time? Maybe something is weird there.
Well I seem to be straighten out finally. What I was fighting I guess is a older or different version of maniacbug's hardware files setup for the sanguino/644P chip which I had downloaded and modified to use the bobuino pins_arduino.h, added a optiboot bootloader file for the 644P, etc.
However there seems to be too many differences between some of the hardware core files between the two different maniacbug's hardware folder I had downloaded and installed. So I dumped all the sanguino hardware folders and just added a new bobuino 644P/optiboot board to the maniacbug-mighty-1284p hardware folders. Then I added your suggested fix to the pins_arduino.h and then recompiled/uploaded the various analog test sketches and all is well in bobuino 644P land for me now, yea.
Thanks for your help, I had never actually tested out my analog pins for this bubuino/644P setup (just like Bob I guess ) so it's good to have that checked off. Still waiting for my 1284P chip to show up, I hope it has at least crossed the international date line by now.
Lefty
Yeah, still doesn't explain, that I can see, the funny business about
#elif defined(AVR_ATmega1284P) || defined(AVR_ATmega644P)
if (pin >= 24) pin -= 24; // allow for channel or pin numbers
I don't know about Sanguino or 644, as they're not included with the maniacbug mighty-1284P-master
files. The files and bootloaders I have are all dated 23 June 2012.
Besides the digital and analog pins, I also checked the PWM pins today with analogWrite(), and
they all look ok, so I think only the analogPinToChannel(p) declaration was wrong.
I just bought some 1284P chips from digikey today, and should arrive on thursday. Yours
are no doubt cheaper, but I want to get this darn thing wrapped up already. Sheesh. Thursday,
I can check the RX0 sensitivity/download problem using the 1284P chips.
On a brighter note, today, my local Coopers hawks returned to their nest in the nearby tree
from their winter sojourn. One can only imagine where they've been all winter since they
left in the fall after their kids had grown. Probably in San Diego, sitting on the beach.
On a brighter note, today, my local Coopers hawks returned to their nest in the nearby tree
from their winter sojourn. One can only imagine where they've been all winter since they
left in the fall after their kids had grown. Probably in San Diego, sitting on the beach.
Well for us that means the hawk population will probably start to dwindle to 1/4 of what we see in the winter as they leave for the north. We have local hawks (mostly red-tails) that are year around.
If your ever interested in populating any of your boards with a 644P chip, here is the boards.txt entry I setup.
##############################################################
bobuino644.name=Bobuino 644P optiboot
bobuino644.upload.protocol=arduino
bobuino644.upload.maximum_size=63488
bobuino644.upload.speed=115200
bobuino644.bootloader.low_fuses=0xff
bobuino644.bootloader.high_fuses=0xdc
bobuino644.bootloader.extended_fuses=0xfd
bobuino644.bootloader.path=optiboot
bobuino644.bootloader.file=optiboot_atmega644p-4-5.hex
bobuino644.bootloader.unlock_bits=0x3F
bobuino644.bootloader.lock_bits=0x0F
bobuino644.build.mcu=atmega644p
bobuino644.build.f_cpu=16000000L
#bobuino644.build.core=arduino:arduino
bobuino644.build.core=standard
bobuino644.build.variant=bobuino
##############################################################
Still waiting for my 1284P chip to show up, I hope it has at least crossed the international date line by now.
Is Mouser shipping these from overseas now?
With >1700 in stock you'd think they'd arrive pretty quick.
CrossRoads:
Still waiting for my 1284P chip to show up, I hope it has at least crossed the international date line by now.
Is Mouser shipping these from overseas now?
With >1700 in stock you'd think they'd arrive pretty quick.
http://www.mouser.com/ProductDetail/Atmel/ATMEGA1284P-PU/?qs=sGAEpiMZZMtVoztFdqDXO3QpeG9FlGm9
Call me a cheapskate but when I click on buy I get this total:
MERCHANDISE TOTAL:
$8.71
SHIPPING CHARGE:
$20.00
ORDER TOTAL:
$28.71
That sounds nuts to me?
So I ordered from Futurlec for like $10 including shipping. I was aware that they take a long time shipping as I've ordered a couple of things from them before in the past, and being retired I'm almost never in a hurry. And because of being able to use a DIP 644P in your same Demu through hole 1284P board you sold me, it's not been non-constructive time spent waiting.
Besides you now have the option of calling your board a 644P/1284P board.
Lefty
I always use USPS Priority Mail shipping from digikey and mouser and jameco, and with the order
I placed yesterday with digikey, the shipping is $4.91. Priority usually takes 2 days to the west
coast. Mouser is a little cheaper than digikey for small quantities, but only digikey had some other
parts I needed for this order.
I also ordered a few atmega32A chips to play with. From what I can tell, these have the same
pinout as 644/1284, but are essentially a 328 in DIP40, so you get a -UNO with 40-pins. Also
2/3 cheaper than the 644/1284. I don't know if there is a bootloader for the 32A, however.
I should have ordered some 644s too, just to play, but forgot.
oric_dan:
I always use USPS Priority Mail shipping from digikey and mouser and jameco, and with the order
I placed yesterday with digikey, the shipping is $4.91. Priority usually takes 2 days to the west
coast. Mouser is a little cheaper than digikey for small quantities, but only digikey had some other
parts I needed for this order.I also ordered a few atmega32A chips to play with. From what I can tell, these have the same
pinout as 644/1284, but are essentially a 328 in DIP40, so you get a -UNO with 40-pins. Also
2/3 cheaper than the 644/1284. I don't know if there is a bootloader for the 32A, however.
So what was the
SHIPPING CHARGE:
$20.00
That Mouser showed me when I clicked on buy it? Is the default hand delivery by limousine? Or some kind of minimum order size hidden as a shipping charge?
Lefty
Those guys have a dozen or more shipping options, with Fedex overnight at the top of the
cost structure, and Fedex or UPS ground near the bottom [and which may take a week].
A guy like you [!!!] should avoid clicking on the upper lines.
$4.99 residential shipping is what I normally see with Mouser. $6.99 for bulkier stuff.
oric_dan:
Those guys have a dozen or more shipping options, with Fedex overnight at the top of the
cost structure, and Fedex or UPS ground near the bottom [and which may take a week].
A guy like you [!!!] should avoid clicking on the upper lines.
But I didn't, I just clicked buy it and that is what popped up. I didn't even go to further screens to see if I had a choice of shipping options. So they in effect 'scared me away' by their choice to default to a or the most costly shipping method. If that had not stated any shipping cost then I might have adventured further into the buying process/screens, to see that options they made available. Just poor web design in my opinion.
Lefty
Looks pretty darn easy to me. I looked at my Mouser cart from yesterday [order not
completed], but once I click on "Checkout" from the cart, it takes me to a succession
of screens [notice the top line], then 3rd screen is here,
CHECKOUT» Addresses» Shipping Method» Payment» Review
Shipping Method
Please select one of the following:Shipping cost determined at the time of shipment.
UPS Ground
UPS 3rd Day
UPS 2nd Day
UPS Next Day Saver
UPS Next Day
UPS Next Day Early AM
FedEx Ground
FedEx 3rd Day
FedEx 2nd Day
FedEx Standard Overnight
FedEx Priority Overnight
FedEx Priority Overnight Early AM
US Postal Service Priority Mail w/Delivery Confirmation
Live wild.
oric_dan:
Looks pretty darn easy to me. I looked at my Mouser cart from yesterday [order not
completed], but once I click on "Checkout" from the cart, it takes me to a succession
of screens [notice the top line], then 3rd screen is here,CHECKOUT» Addresses» Shipping Method» Payment» Review
Shipping Method
Please select one of the following:Shipping cost determined at the time of shipment.
UPS Ground
UPS 3rd Day
UPS 2nd Day
UPS Next Day Saver
UPS Next Day
UPS Next Day Early AM
FedEx Ground
FedEx 3rd Day
FedEx 2nd Day
FedEx Standard Overnight
FedEx Priority Overnight
FedEx Priority Overnight Early AM
US Postal Service Priority Mail w/Delivery ConfirmationLive wild.
You seem to miss my point. They don't leave the shipping cost as a blank when I first hit buy it for a $8 DIP chip, put rather it displayed a $20 shipping cost that didn't even mention the shipping method or that other shipping methods are avalible further into the checkout process. That's pretty dumb of them and just a poor marketing design, and that was my point. Most mail order companies offer shipping choices as Mouser does, I just choose to not go further into the buying process.
Lefty
I think you must have clicked on the famous Twilight Zone button.
oric_dan:
I think you must have clicked on the famous Twilight Zone button.
Just the link Bob posted, give it a try.
CrossRoads:
Still waiting for my 1284P chip to show up, I hope it has at least crossed the international date line by now.
Is Mouser shipping these from overseas now?
With >1700 in stock you'd think they'd arrive pretty quick.
http://www.mouser.com/ProductDetail/Atmel/ATMEGA1284P-PU/?qs=sGAEpiMZZMtVoztFdqDXO3QpeG9FlGm9
Lefty
I don't see that shipping is shown until after the address entry page, and then the list of shipping options appears to pick from.