Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Definitive links to adding new MCU's

(you are viewing a thread; or go back to list of threads)

Definitive links to adding new MCU's (by Ziggy)
Hello Forum,

I had come across some information in the past relating to setting up new micro controller profiles.
Unfortunately for one reason or another I can not find that information now.

Could those amongst us who know where this kind of information can be located please post the links under this above title.

I look forward to Your assistance in this matter.

I ALSO WISH TO ASK THOSE WHO DO NOT KNOW NOT TO PUT UP TANGENTIAL QUESTIONS IN THIS POSTING.
Tue Mar 26 2013, 02:59:24
(no subject) (by Jonathan Westhues)
I'm not sure there's any particularly good description of that process already on the forum.

Are you looking to add a new micro for a supported architecture (like, a new AVR, or a new PIC16), or to add an entirely new architecture? The former is usually just a change to the tables in mcutable.h, and perhaps a bit of code to handle any special peripherals. The latter is a bigger project.
Tue Mar 26 2013, 04:47:11
(no subject) (by Ziggy)
I am looking to the newer Atmega8,16 and 32 variants mega88, mega164 and mega324 MCUs.

I do not know how much longer the older part numbers will be available.
I expect to hear shortly from local Atmel reps when the old line up might become obsolete.

I had a look at the mcutable.h listing. Seems pretty straight forward although the " back end " assembler section may need some more work due to relocations and renaming of registers.

I may come back with some more specific questions about the meaning of various entries in mcutable.h file in the first instance.

PS apologies if the other posting broke house rules.
Tue Mar 26 2013, 17:36:02
(no subject) (by Jonathan Westhues)
No problem; and as you say, that should be mostly just a question of adding the mcutable.h entries, and making any necessary changes to the peripheral setup. Let me know if you have any questions as you look at that more closely.
Wed Mar 27 2013, 02:18:41
(no subject) (by Ziggy)
Devices ATmega164 and ATmega324 are somewhat upgraded versions of Atmega16 and ATmega32.
The following excerpt from mcutables.h is fairly self explanatory.
A list of port labes with physical pin numbers and port IOline numbers along with ADC PORT pin and IO numbers.


// ATmega16 or ATmega32

McuIoPinInfo AvrAtmega16or32IoPinInfo[] = {
{ 'B', 0, 1 },
{ 'B', 1, 2 },
{ 'B', 2, 3 },
{ 'B', 3, 4 },
{ 'B', 4, 5 },
{ 'B', 5, 6 },
{ 'B', 6, 7 },
{ 'B', 7, 8 },
{ 'D', 0, 14 },
{ 'D', 1, 15 },
{ 'D', 2, 16 },
{ 'D', 3, 17 },
{ 'D', 4, 18 },
{ 'D', 5, 19 },
{ 'D', 6, 20 },
{ 'D', 7, 21 },
{ 'C', 0, 22 },
{ 'C', 1, 23 },
{ 'C', 2, 24 },
{ 'C', 3, 25 },
{ 'C', 4, 26 },
{ 'C', 5, 27 },
{ 'C', 6, 28 },
{ 'C', 7, 29 },
{ 'A', 7, 33 },
{ 'A', 6, 34 },
{ 'A', 5, 35 },
{ 'A', 4, 36 },
{ 'A', 3, 37 },
{ 'A', 2, 38 },
{ 'A', 1, 39 },
{ 'A', 0, 40 },
};

McuAdcPinInfo AvrAtmega16or32AdcPinInfo[] = {
{ 40, 0x00 },
{ 39, 0x01 },
{ 38, 0x02 },
{ 37, 0x03 },
{ 36, 0x04 },
{ 35, 0x05 },
{ 34, 0x06 },
{ 33, 0x07 },
};

The following listing is not quite as self evident

Meaning of

16*1024
{ { 0x60, 2048 } }

...

1023,
{ 14, 15 },
0,
ISA_AVR,
TRUE,
0

Is there a record of where the descriptions of above entries can be found?

{
"Atmel AVR ATmega32 40-PDIP",
'P',
{ 0x39, 0x36, 0x33, 0x30 }, // PINx
{ 0x3b, 0x38, 0x35, 0x32 }, // PORTx
{ 0x3a, 0x37, 0x34, 0x31 }, // DDRx
16*1024,
{ { 0x60, 2048 } },
AvrAtmega16or32IoPinInfo,
arraylen(AvrAtmega16or32IoPinInfo),
AvrAtmega16or32AdcPinInfo,
arraylen(AvrAtmega16or32AdcPinInfo),
1023,
{ 14, 15 },
0,
ISA_AVR,
TRUE,
0
},
Sat Mar 30 2013, 06:38:31
(no subject) (by Jonathan Westhues)
Look at the definition of McuIoInfo in ldmicro.h.

Some per-micro customization also tends to be necessary in the code generating back end (avr.cpp), to set up the peripherals correctly and such.
Sat Mar 30 2013, 19:22:25
mcu support (by Shivansh)
Hi,
I have used pic16f877-TQFP44 microcontroller instead of 40pdi package.


Please make me sure that it will work
Wed May 21 2014, 02:45:28
Added 328(Arduino Uno) (by Akshay)
Hi,
I have tried to add support for Arduino Uno and the simple contacts and rung experiment is not working properly (contact pin goes high while rung pin stays low inspite of whatever operation I do on contacts pin ). I did not make any changes to avr.cpp and added arduino.cpp instead as it would have been too messy since most of the registers and position of the bits in the same did not match. I have attached arduino.cpp (btw I have not made any changes to the logics for arithmetic operations or pwm or adc logic) just in case. Kindly verify the following changes in "SupportedMcus" array as I am not sure of them.

{
"Atmel AVR ATmega328 28-PDIP",
'P',
{ 0xff, 0x23, 0x26, 0x29 }, // PINx (but there is no xxxA)
{ 0xff, 0x25, 0x28, 0x2B }, // PORTx
{ 0xff, 0x24, 0x27, 0x2A }, // DDRx
1*1024, //not sure
{ { 0x60, 1024 } }, //not sure
AvrAtmega328_28PDIPIoPinInfo,
arraylen(AvrAtmega328_28PDIPIoPinInfo),
AvrAtmega328_28PDIPAdcPinInfo,
arraylen(AvrAtmega328_28PDIPAdcPinInfo),
1023, //not sure
{ 2, 3 },
17, // Guess I am only using OC2A for pwm
ISA_ARDUINO,
TRUE,
0
}
Fri Apr 17 2015, 02:36:57, download attachment arduino.cpp
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):