Rapa Nui
Offline
God Member
Karma: 16
Posts: 881
Pukao hats cleaning services
|
 |
« Reply #15 on: February 25, 2013, 09:26:18 am » |
I am suggesting the mighty layout (you already did above) - for all DIP40 chips: 16/32/324/64/644/1284. The 32U4 is not available in DIL40, afaik.. #elif defined(__AVR_ATmega1284P__)\ || defined(__AVR_ATmega1284__)\ || defined(__AVR_ATmega644P__)\ || defined(__AVR_ATmega644__)\ || defined(__AVR_ATmega64__)\ || defined(__AVR_ATmega32__)\ || defined(__AVR_ATmega324__)\ || defined(__AVR_ATmega16__) // Mighty Layout ..
|
|
|
|
« Last Edit: February 25, 2013, 09:35:07 am by pito »
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 881
Pukao hats cleaning services
|
 |
« Reply #16 on: February 25, 2013, 09:46:54 am » |
It seems the toggling ie. pin31 does not work (nor 14,23,24..). This works: #include <DigitalIO.h> // Create object for pin XX in output mode and demo toggle(). DigitalPin<31> pin31(OUTPUT); void setup() {} void loop() { // toggle is a two byte instruction that executes // in two cycles or 125 ns on a 16 MHz CPU //pin31.toggle(); // <<does not work //delay(250);
pin31 = 0; // <<<this blinks delay(250); pin31 = 1; delay(250); } The same with fastDigitalToggle(PIN)..
|
|
|
|
« Last Edit: February 25, 2013, 10:17:57 am by pito »
|
Logged
|
|
|
|
|
0
Offline
Edison Member
Karma: 28
Posts: 1077
Arduino rocks
|
 |
« Reply #17 on: February 25, 2013, 10:29:14 am » |
The 32U4 is not available in DIL40, afaik.. I am not worried about 40 pin 32U4. If I choose the "standard layout for these: #elif defined(__AVR_ATmega1284P__)\ || defined(__AVR_ATmega1284__)\ || defined(__AVR_ATmega644P__)\ || defined(__AVR_ATmega644__)\ || defined(__AVR_ATmega64__)\ || defined(__AVR_ATmega32__)\ || defined(__AVR_ATmega324__)\ || defined(__AVR_ATmega16__)
What about SANGUINO and Bobuino boards? I will look at the data sheet for toggle. It may not work on this family. It could also be a compiler problem. The compiler must compile this way: // will compile to sbi and PIN register will not be read. *pinMap[pin].pin |= 1 << pinMap[pin].bit;
|
|
|
|
« Last Edit: February 25, 2013, 10:34:14 am by fat16lib »
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 881
Pukao hats cleaning services
|
 |
« Reply #18 on: February 25, 2013, 10:38:25 am » |
What about SANGUINO and Bobuino boards? The pin layout and core is defined in /variants/blabla and /cores/blabla (where the board.txt points to the actual core and variant) .. So, the best solution would be, if all libs creators will use the settings coming from those folders, somehow.. 
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15310
Measurement changes behavior
|
 |
« Reply #19 on: February 25, 2013, 10:38:44 am » |
I am not sure what you are suggesting.
Should I have more than one pin layout for 40-pin DIP processors?
Sangino defines the analog pins and digital pins 24 - 31 in a different order than mighty.
If so how do I know which layout to use?
With ATmega32U4 I have Leonardo and Teensy and the CORE_TEENSY symbol lets me choose the pin layout.
Edit: I looked at the three variants and don't see a #define that helps for Standard, SANGUINO, Bobuino.
Well that's why the user's hardware variants allow for unique pin mappings for different board pin out assignments even if the same avr chip is being used. For example the mighty 1284P and the Bobuino 1284P define different pins_arduino.h files to be used when their board type is selected even though they use the same avr chip. Can't your IO additions utilize the standard pin mapping that automatically gets selected when the board type is chosen? Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 881
Pukao hats cleaning services
|
 |
« Reply #20 on: February 25, 2013, 10:46:05 am » |
..or, to make it simple, to make your IO defs based on (boards.txt): atmega32_11_115.build.core=mighty32 atmega32_11_115.build.variant=mighty32
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Edison Member
Karma: 28
Posts: 1077
Arduino rocks
|
 |
« Reply #21 on: February 25, 2013, 10:48:32 am » |
retrolefty, Well that's why the user's hardware variants allow for unique pin mappings for different board pin out assignments even if the same avr chip is being used. For example the mighty 1284P and the Bobuino 1284P define different pins_arduino.h files to be used when their board type is selected even though they use the same avr chip. Can't your IO additions utilize the standard pin mapping that automatically gets selected when the board type is chosen?
Lefty
No you can't generate fast bit set and bit clear instruction with the variant maps.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15310
Measurement changes behavior
|
 |
« Reply #22 on: February 25, 2013, 10:52:12 am » |
retrolefty, Well that's why the user's hardware variants allow for unique pin mappings for different board pin out assignments even if the same avr chip is being used. For example the mighty 1284P and the Bobuino 1284P define different pins_arduino.h files to be used when their board type is selected even though they use the same avr chip. Can't your IO additions utilize the standard pin mapping that automatically gets selected when the board type is chosen?
Lefty
No you can't generate fast bit set and bit clear instruction with the variant maps. Well then I guess you will just have to decide which 1284P 'boards' you wish to support for you IO command additions, as there is no 'official' arduino standard pin out assignment for the 1284P or 644P board types, or for that matter any AVR chip that is not already used in a Arduino company produced board type. Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 881
Pukao hats cleaning services
|
 |
« Reply #23 on: February 25, 2013, 11:02:00 am » |
Something like: #elif defined(__variant_mighty32__) || defined(__variant_mighty64__)|| defined(__variant_mighty1284__).. etc. // Mighty Layout .. #elif defined(__variant_bobulino32___) || defined(__variant_bobulino64__)... // Bobulino Layout .. #elif defined(__variant_sanguino32___) || defined(__variant_sanguino64__)... // Sanguino Layout ..
where the __variant_XY__ comes from actual boards.txt used: atmega32_11_115.build.core=mighty32 atmega32_11_115.build.variant=mighty32
|
|
|
|
« Last Edit: February 25, 2013, 11:05:15 am by pito »
|
Logged
|
|
|
|
|
0
Offline
Edison Member
Karma: 28
Posts: 1077
Arduino rocks
|
 |
« Reply #24 on: February 25, 2013, 11:03:59 am » |
pito, I can't pursue the toggle problem since I don have hardware. The data sheet says it should work and it seems to compile correctly: DigitalPin<31> pin31(1);
void toggle() { pin31.toggle(); } 4: d7 9a sbi 0x1a, 7 ; 26 6: 08 95 ret
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Edison Member
Karma: 28
Posts: 1077
Arduino rocks
|
 |
« Reply #25 on: February 25, 2013, 11:08:42 am » |
pito,
How do symbols like __variant_mighty32__ get define?
|
|
|
|
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 881
Pukao hats cleaning services
|
 |
« Reply #26 on: February 25, 2013, 11:11:20 am » |
How do symbols like __variant_mighty32__ get define? From within the build environment - it is get parsed from boards.txt as it is used in the build process (in order to select cores an variants folders for the actual build)..
|
|
|
|
« Last Edit: February 25, 2013, 11:21:28 am by pito »
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 881
Pukao hats cleaning services
|
 |
« Reply #27 on: February 25, 2013, 11:19:50 am » |
I can't pursue the toggle problem since I don have hardware. The data sheet says it should work and it seems to compile correctly: My hw (atmega32) keeps the pin level low when doing: pinXY.toggle(); delay(250);
in a loop. It is my understanding it should have blinked.. PS: it stays at the level set with ie: pin13.config(OUTPUT, HIGH);
|
|
|
|
« Last Edit: February 25, 2013, 11:33:27 am by pito »
|
Logged
|
|
|
|
|
0
Offline
Edison Member
Karma: 28
Posts: 1077
Arduino rocks
|
 |
« Reply #28 on: February 25, 2013, 11:25:24 am » |
pito, I searched all the maniacbug-mighty files and don't find the symbols. Does this sketch print Yes? void setup() { Serial.begin(9600); #ifdef __variant_mighty32__ Serial.println("Yes"); #else Serial.println("No"); #endif } void loop() {}
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Edison Member
Karma: 28
Posts: 1077
Arduino rocks
|
 |
« Reply #29 on: February 25, 2013, 11:28:51 am » |
My hw (atmega32) keeps the pin level low when doing: Code:
pinXY.toggle(); delay(250);
in a loop. It is my understanding it should have blinked..
It does on Uno and Mega.
|
|
|
|
|
Logged
|
|
|
|
|
|