Coder Social home page Coder Social logo

thomasonw / atmegaxxm1-c1 Goto Github PK

View Code? Open in Web Editor NEW
30.0 30.0 18.0 2.19 MB

Arduino IDE support files for CAN enabled Atmel AVR chips: ATmega64M1, ATmega32M1, ...

License: GNU Lesser General Public License v2.1

C++ 60.37% C 37.92% Assembly 1.71%

atmegaxxm1-c1's People

Contributors

christophjurczyk avatar falconfour avatar geraldjust avatar per1234 avatar thomasonw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atmegaxxm1-c1's Issues

ATmega16u2 USB-to-serial support

Dear thomasonw, first of all thanks for your great work: it has been of extreme help in one of my recent project!
I don't know if this is the right place to open this issue but otherwise I wouldn't know who to ask to.
I'm trying to build a custom Arduino-style board developed around the ATmega32M1 which I managed to program with your bootloader effortlessy: to be able to use it exactly as an Arduino I've integrated in my pcb also a ATmega16u2 with the exact same connections used in an Arduino (TXD, RXD, CTS) to be able to program the 32M1 via USB taking advantage of the USB-to-serial firmware available for the 16u2. My problem is that although I'm able to load this firmware without any problem (using a USBasp programmer and avrdude) I cannot make the 16u2 communicate with the 32M1: when I try to upload a sketch in the same way that you would do it for an Arduino I receive the avrdude device not in synch resp=0x00 error that usually occurs when you try to program the wrong Arduino board. Are you aware of any change that has to be made to that firmware to make the 2 chips talk (e.g. Product ID, communication frequency...)
If you feel like this is the wrong place to ask can you suggest me where to find an answer?

analogWrite on digital Pins and digitalWrite on analog pins

Hello, I have a problem with the DAC. When I try to write on the D10 with an analogWrite it seems to ignore it.

Example:

#define DAC 10

void setup() {
    pinMode(DAC, OUTPUT); 
}
void loop(){
    analogWrite(DAC, 512);
}

When I physically read the voltage with the multipler the voltage stays fixed at 0.21 volts. I also tried to change the value (ranging from 0 to 1023) and remove pinMode(DAC, OUTPUT) but it doesn't change.

When I instead use digitalWrite(DAC, HIGH) it works.

Moreover I need to set the SLEEP and RESET pins to HIGH but seems like I am missing something, because the voltage stays fixed at 0

#define SLEEP A3
#define RESET A4

void setup() {
    pinMode(SLEEP, OUTPUT); 
    pinMode(RESET, OUTPUT); 
}
void loop(){
    digitalWrite(RESET, HIGH);
    digitalWrite(SLEEP, HIGH);
}

Do you have any ideas if I am missing something?

32m1 Compatibility

Hi, Love the support you brought these uC. But ive been having some issues with the 32m1 uC.

i get the following error trying to burn the bootloader:

avrdude: verification error, first mismatch at byte 0x7e00
         0x00 != 0x11
avrdude: verification error; content mismatch
Error while burning bootloader.

Ive used the 64m1 just fine. ive ran the 64m1 with the int osc. then a external 8mhz and a 16mhz and all those seem fine. But i keep getting this error for the 32m1. Not sure if there is something wrong with the verification for the bits or a fuse is not burn the right way.

Thanks for all your hard work!

Gerald R.

boards.txt updating

Hey! sorry to bug again. I have been working on a updated board.txt file. So i have made it compatible with the file name you have. Its been compiling just fine. I even added a menu on the board option for the PSC to be OFF, LOW, HIGH.

But when uploading it, ive noticed that its using the arduino avrdude.conf rather then the custom one in the core hardware folder. so i get a error saying the 64m1 is not available.

Here is the new code for the boards.txt:

`
############################################################

menu.clock=Clock
menu.PSC=PSC
menu.variant=Variant

############################################################

AtmegaX1.name=ATmegaX1
AtmegaX1.upload.tool=arduino:avrdude
AtmegaX1.upload.protocol=arduino
AtmegaX1.build.variant=ATmegaxxM1

AtmegaX1.bootloader.tool=arduino:avrdude
AtmegaX1.bootloader.unlock_bits=0x3F
AtmegaX1.bootloader.lock_bits=0x0F

AtmegaX1.menu.variant.64m1=ATmega64m1
AtmegaX1.menu.variant.64m1.build.mcu=atmega64m1
AtmegaX1.menu.variant.64m1.build.board=ATmega64M1
AtmegaX1.menu.variant.64m1.build.name2=atmega64M1
AtmegaX1.menu.variant.64m1.upload.maximum_size=64512
AtmegaX1.menu.variant.64m1.upload.maximum_data_size=4096

AtmegaX1.menu.variant.32m1=ATmega32m1
AtmegaX1.menu.variant.32m1.build.mcu=atmega32m1
AtmegaX1.menu.variant.32m1.build.board=ATmega32M1_16xtl
AtmegaX1.menu.variant.32m1.build.name2=atmega32M1
AtmegaX1.menu.variant.32m1.upload.maximum_size=32256
AtmegaX1.menu.variant.32m1.upload.maximum_data_size=2048

AtmegaX1.menu.PSC.OFF=OFF
AtmegaX1.menu.PSC.OFF.bootloader.extended_fuses=0x3D
AtmegaX1.menu.PSC.LOW=LOW
AtmegaX1.menu.PSC.LOW.bootloader.extended_fuses=0x1D
AtmegaX1.menu.PSC.HGH=HIGH
AtmegaX1.menu.PSC.HIGH.bootloader.extended_fuses=0x05

##############################################################

#make atmegaXXm1 AVR_FREQ=16000000L BAUD_RATE=57600
AtmegaX1.menu.clock.16MHz_external.build.core=arduino
AtmegaX1.menu.clock.16MHz_external.build.f_cpu=16000000L
AtmegaX1.menu.clock.16MHz_external=16MHz External
AtmegaX1.menu.clock.16MHz_external.upload.speed=57600
AtmegaX1.menu.clock.16MHz_external.bootloader.low_fuses=0xFF
AtmegaX1.menu.clock.16MHz_external.bootloader.high_fuses=0xDE
AtmegaX1.menu.clock.16MHz_external.bootloader.file=optiboot/optiboot_{build.name2}_16Mhz.hex

#make atmegaXXm1 AVR_FREQ=16000000L BAUD_RATE=57600
AtmegaX1.menu.clock.8MHz_external.build.core=arduino
AtmegaX1.menu.clock.8MHz_external.build.f_cpu=8000000L
AtmegaX1.menu.clock.8MHz_external=8MHz External
AtmegaX1.menu.clock.8MHz_external.upload.speed=57600
AtmegaX1.menu.clock.8MHz_external.bootloader.low_fuses=0xFF
AtmegaX1.menu.clock.8MHz_external.bootloader.high_fuses=0xDE
AtmegaX1.menu.clock.8MHz_external.bootloader.file=optiboot/optiboot_{build.name2}_8Mhz.hex

#make atmegaXXm1 AVR_FREQ=8000000L BAUD_RATE=57600
AtmegaX1.menu.clock.8MHz_internal.build.core=arduino
AtmegaX1.menu.clock.8MHz_internal.build.f_cpu=8000000L
AtmegaX1.menu.clock.8MHz_internal=8MHz Internal
AtmegaX1.menu.clock.8MHz_internal.upload.speed=57600
AtmegaX1.menu.clock.8MHz_internal.bootloader.low_fuses=0xF2
AtmegaX1.menu.clock.8MHz_internal.bootloader.high_fuses=0xDE
AtmegaX1.menu.clock.8MHz_internal.bootloader.file=optiboot/optiboot_{build.name2}_8MHz.hex

############################################################
`

do you know what links , or makes it use the avrdude.conf from the custom file?

I2C and SPI protocoles

Hi Thomas!
First of all, congratulations for your API, it is a great job.
But, I would like to know if I can use SPI or I2C libraries using the ATMegaxxM1 with arduino IDE.
Thanks in advance.

Board clock mismatch

Dear thomasonw I'm encountering some problem with the clock of the board using your code.
I noticed it because the serial comunication wich I set to 9600 instead is actualy at 600.
My board has a 16MHz xtal and I'm using the right bootlader version ATmega64M1 (16MHz - xtal - Arduino). Can you tell me more about it ?
Many thanks.

Sleep Mode

Hi! sorry to bug again. But ive been trying to get the 64m1 to work with the low power library from here: https://github.com/rocketscream/Low-Power
from the datasheets it seems like the 328p and the 64m1 are very similar. But i know there are a phew changed compared to the 328p. does not have a timer2, it only has 4 sleep modes rather then 6. And there are a couple of registers that are different as it doesn't have a i2c bus. But it does have LIN controller, and CAN.
My question if it would be easy to port the low power library for this Micro. As one of the few reasons why this uC is interesting is that it also has a good low power way to manage it.

Typo in project description

Was just telling a friend about this repo & the awesome power of the ATmegaxxM1-C1 series chips... and I noticed a typo in the repo description:

CAN enabled Amtel AVR chips

Tiny little thing, but Atmel** ๐Ÿ˜„

Easy issues are the best, aren't they?

Problems getting project running under platformio

I created a new project in platformio and did as suggested

command: pio pkg install --library "thomasonw/ATmegaxxM1-C1@^1.0.4"

Resolving megaatmega1280 dependencies...
Library Manager: Installing thomasonw/ATmegaxxM1-C1 @ ^1.0.4
Downloading [####################################] 100%
Unpacking [####################################] 100%
Library Manager: [email protected] has been installed

The resulting platformio.ini

[env:test]
platform = atmelavr
board = ATmegaxxM1-C1
framework = arduino
lib_deps = thomasonw/ATmegaxxM1-C1@^1.0.4

When building I get the error:
UnknownBoard: Unknown board ID 'ATmegaxxM1-C1'

I also tried as board: "ATmegaxxM1", "atmega64m1_16Mhz_xtl"

Pin change interrupt on D10

The datasheet is wrong on page 88, PCICR, Bit PCIE1 states PCINT[14:8], but this should be PCINT[15:8], because D10 (PC7) corresponds to PCINT15 and this pin does generate an interrupt.

I added pin D10 to the header file like this:

#define digitalPinToPCICRbit(p) ( ((p) == 5  || (p) == 6) || \
                                  ((p) == 8  || (p) == 9) || \
                                  ((p) == 17)             || \
                                  ((p) >= 21 && (p) <=23) ? 0 : \
                                ( ((p) >=  2 && (p) <= 4) || \
                                  ((p) == 12 || (p) ==10) || \
                                  ((p) >= 18 && (p) <=20) ? 1 : \
                                2))


#define digitalPinToPCMSK(p)    ( ((p) == 5  || (p) == 6) || \
                                  ((p) == 8  || (p) == 9) || \
                                  ((p) == 17)             || \
                                  ((p) >= 21 && (p) <=23) ? (&PCMSK0) : \
                                ( ((p) >=  2 && (p) <= 4) || \
                                  ((p) == 12 || (p) ==10) || \
                                  ((p) >= 18 && (p) <=20) ? (&PCMSK1) : \
                                (&PCMSK2)))

and the interrupt works fine.
Is this remark:

// Port D10 does not support Soft Serial

only due to the flaw in data sheet? With this patch it could then be removed.

Using the PSC in M1 variants

Does this allow for use of the power stage controller in M1 versions of these chips?

Say, to drive an H-bridge with ultrasonic PWM without touching TIMER 0 & 1?

Install Compatibility with Arduino IDE 2.0

Hi there, just wondering if this package is compatible with Arduino IDE 2.0? When I try to install, I'm hit with:

Tool arduino:[email protected] already installed
Tool arduino:[email protected] already installed
Downloading packages
ATmegaM1-C1:[email protected]
Installing platform ATmegaM1-C1:[email protected]
Failed to install platform: 'ATmegaM1-C1:avr:1.0.8'.
Error: 13 INTERNAL: Cannot install platform: installing platform ATmegaM1-C1:[email protected]: extracting archive: open C:\Users\Admin\AppData\Local\Arduino15\tmp\package-1226863038: is a directory

Thanks :)

Bootloader source code

Hi!

Could you please upload the actual source code you used when you compiled Optiboot for these AVRs? I'd like to add ATmega16/32/64M1 and ATmega32C1/64C1 to my Optiboot flash repo and was hoping to use the source code (particularly the contents of pin_defs.h) as a template when adding these chips.

Warning: Board ATmegaM1-C1:avr:CanDuino doesn't define a 'build.board' preference

Hi I'm trying to use these board files to upload a blank sketch to the ATmega32M1 but I'm getting the following error:

Warning: Board ATmegaM1-C1:avr:CanDuino doesn't define a 'build.board' preference. Auto-set to: AVR_CANDUINO
fork/exec ~/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/bin/avr-g++: bad CPU type in executable
Error compiling for board ATmegaxxM1/C1.

Arduino IDE Version: 1.8.12
macOS Version: 10.15.4

This is my board configuration:
image

And finally programmer is a Polulu USB AVR Programmer V2.

Vcc reading

Hi,
When I use analogRead(A9) to get the Vcc/4 value, it returns a value around 153 for a 5V supply. If I decrease the supply voltage, this value increases. I can't find any information in the datasheet on what reference voltage is used when the ADC selects the Vcc/4 channel either, so I'm clueless on what the returned value means.
Has anyone here used this feature before?

Thank you in advance!
Regards.

ATmega64m1-MZ

By any chance do you know if there is a difference between the regular AU and the MZ version of the chip? I made a board with both types. They Both seem to work just fine when i try to burn the bootloader and the fuse bytes. but as soon as it does that. All the pins are pulled High. Checked and it has the same device signature and everything. The only thing digging around i found this 1611-ATMEGA64M1-15MZCT-ND digikey part number and the following pdf.

http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7647s-Automotive-Microcontrollers-ATmega16M1-32M1-64M1-32C1-64C1_Datasheet.pdf

Thank you!

Turn off the timer0

I've found an issue on using this platform.
If I turn off the timer0 with the instruction Turn off the TCCR0B = 0 nothing works.

Any suggestion?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.