Coder Social home page Coder Social logo

spencekonde / megatinycore Goto Github PK

View Code? Open in Web Editor NEW
532.0 38.0 135.0 49.12 MB

Arduino core for the tinyAVR 0/1/2-series - Ones's digit 2,4,5,7 (pincount, 8,14,20,24), tens digit 0, 1, or 2 (featureset), preceded by flash in kb. Library maintainers: porting help available!

License: Other

C 77.61% C++ 9.28% Assembly 0.05% Shell 0.01% Batchfile 0.03% Makefile 0.41% Python 12.61%
arduino avr attiny tinyavr tinyavr-0 tinyavr-2 arduino-core board-manager tinyavr-1

megatinycore's People

Contributors

aingerujm avatar azmisov avatar brunob45 avatar clarkbremer avatar dalemitchell avatar dattasaurabh82 avatar dork3nergy avatar fredolaredo avatar freemovers avatar instantmuffin avatar jschneider1207 avatar jvasileff avatar kadamski avatar kroesche avatar lordjakson avatar mairas avatar mcudude avatar mechatroniks-git avatar modac avatar mx682x avatar netkruzer avatar obviousinretrospect avatar oseiler2 avatar per1234 avatar rneurink avatar spencekonde avatar tagno25 avatar veganism avatar westfw avatar xieliwei 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

megatinycore's Issues

Fill in feature table

To avoid painting ourselves into a corner, we need a table of all the megaAVR attiny chips that are planned for support. This is a great way that people interested in megaAVR who aren't up to digging around in the core itself to help the project - hunt down datasheets, grab data, update spreadsheet, say something in this issue to let me know that an update has happened

This should list:
Number of each timer available on each part.
Amount of SRAM on each part
Presence/absence of DAC on each part (is this just all 1-series have a DAC, all 0-series do not? Is TCD like that too?)
Amount of EEPROM on each part

If you find any parameters that ought to be listed as well, add a column to the spreadsheet and add them.

Here is a google docs spreadsheet link. Editing is enabled (i'm trusting that everyone who bothers to see this will act in good faith and not vandalize it, hopefully I won't be disappointed in humanity)

https://docs.google.com/spreadsheets/d/1qALSjPBiLNx4_Er7RJg_b-INfTGehrhXASba9B7dShI/edit?usp=sharing

Documentation

Note that many of these depend on design decisions not yet made - this is mostly to gather up a list of what needs to be done

We need
ReadMe.md with general information
Installation.md - covering manual and board manager installation
Part-specific documentation files - maybe? Maybe not, as these are far less individual than the classic AVR attiny series. Maybe it just needs to be a 0-series and 1-series doc?

Support t816, t416

There are a few subtle differences between the t1616/3216 and t416/816. We need to account for these. At present it's not clear to me whether this can be done with the same variants files or whether a new variant is needed. But it looks like it may just work? I don't see TCB being used for anything?

HID library?

How does this work, when these parts don't have native USB?!

Does this rely on firmware on the interface chip on the Uno WiFi Rev. 2? In that case, it needs to get the axe.

Pick a timer, any timer!

Important decisions need to be made regarding which timers to use for what on which chips.

Discuss selection of which timer/counter units to use for what here.

special case for analogWrite(DACPIN,255)

This should not do digitalWrite() but rather set DAC0.DATA=255, else it will jump from 254 255ths of the DAC VREF voltage (which can't be set to Vcc) all the way up to Vcc.

May also need exceptions as part of #51.

Bootloader support

This is a long way off, but all these boards have UARTs. We should be able to put a bootloader on them - however considerable work would be required to create a serial bootloader for these, and we have no timeline for this.

Support 412/212

These are the 8-pin (5 GPIO) versions.

Again, looks like just needs a pinmapping (plus solution for tone and the shortage of timers described in #11)

Add Servo library

We need a megaAVR compatible implementation of Servo.h. See also #16 regarding where to use what timer.

Add An constants back in

On reflection, I think removing these will create more problems than it solves.

It's much simpler here though, since the ADC on the megaAVRs doesn't have differential channels (interesting - they dropped a feature that the classicAVRs had from the megaAVRs - I suspect the reasoning being that hardly anyone used them)

Use Travis CI for automated testing

I'd be happy to set up Travis CI on this repository when you're ready for it. Here is the list of tests I can add:

My preference would be to all of the above, but you are welcome to pick and chose whichever ones you like.

Required infrastructure:

  • Enable Travis CI for this repository:
  • If you want compilation report publishing:
    • Create a megaTinyCore branch in https://github.com/SpenceKonde/CI-Reports.
    • Open https://travis-ci.org/SpenceKonde/megaTinyCore/settings
    • Under the "Environment Variables" section, enter REPORT_GITHUB_TOKEN in the "Name" field.
    • Enter your personal access token in the "Value" field. This can be the same token used for ATTinyCore, or you can create a dedicated one if you prefer. If creating a new token, check the box next to public_repo to give it the necessary permissions.
    • Make sure the "Display value in build log" switch is in the off position.
    • Click the "Add" button.

Reorganize files so you can sync it to hardware folder

I'm going to rearrange the files so it can be sync'ed to hardware for manual install, instead of being board manager only.

Also need to update platform.txt to identify it at megaTinyCore. Once things are working, we'll probably want to remove the non attiny boards. I'm going to look into the available megaAVR attiny parts and order some in SOIC to start playing with this.

What kind of programmer do I want to buy for these, to get started?

NUM_TOTAL_PINS

This macro seems to be wrong... as the SPI and I2C pins are included in NUM_DIGITAL_PINS (maybe they aren't on the '4809 as used in the WiFi Rev 2?), but those are added together to get NUM_TOTAL_PINS, which thus exceeds the number of actual pins.

no tone on 416/816

We don't have a timer for it that can be used without hosing millis().

Currently worked around by just #ifdef'ing out all of tone if there's no TCB1, but this isn't a good longterm solution

Reduce flash/memory use of core and libraries

Current the core and it's libraries are flash hogs. This is problematic on the smaller ATtiny parts. We now create the assembler listing when dumping the compiled binary, so we have the tools we need to see where space is going and whether we can slim things down.

It would be helpful to flag up any libraries or core functions that you find to be particular space hogs for special attention within this issue.

API missing

The original Arduino core has a separate repository for the API. Add installation instructions for the API as well (see following note from the readme file), or add the API folder to this repository:

Developing

Create an <SKETCHBOOK>/hardware/arduino folder. Where <SKETCHBOOK> is the location of your Arduino sketchbook.
Change directories: cd <SKETCHBOOK>/hardware/arduino
Clone this repo: git clone https://github.com/arduino/ArduinoCore-megaavr.git megaavr
Change directories: cd megaavr/cores/arduino
Copy or symlink the api folder from the ArduinoCore-API repo.
Restart the IDE

Suspect entries in boards.txt

Why is there a vid/pid here? These boards to not have native USB, and are used with a jtag2updi programmer.

at1616.vid.0=0x2341
at1616.pid.0=0x0058

Why is there a bootloader file for the 4809 when these are programmed via UPDI without a bootloader?

Is that fuse file correct for the tiny series? Is "burn bootloader" required for the new megaAVRs to set fuses to the correct clock speed or other parameters?

at1616.bootloader.tool=avrdude
at1616.bootloader.file=atmega4809_uart_bl.hex
at1616.bootloader.SYSCFG0=0xC9
at1616.bootloader.BOOTEND=0x00
at1616.bootloader.OSCCFG=0x01
at1616.fuses.file=fuses_4809.bin

Make timer d PWM suck less

Right now, you need to stop the timer, delay(1), and restart it to enable or disable PWM on a pin.

I would love to find a more graceful way of doing this, as it pulls in delay(), blocks for a millisecond, and makes a glitch on the other timer d pin.

I think if I moved the digitalWrite() tests for 0 and 255, and didn't use that shortcut for the timer d pins (and adjusted digital write to effectively analogWrite() the pin 0 or 255), I would get the desired behavior. If not in DS mode, maybe in a different mode - the different modes are very hard to understand from the datasheet. They clearly don't have people of the same caliber writing the datasheets now as they did in the classic AVR days.

Get timer issue while testing PWM outputs

C:\Users\svandebor\Documents\Arduino\hardware\megaTinyCore\megaavr\cores\arduino\wiring.c:71:8: warning: missing terminating " character

#error "No millis timer selected.

    ^

C:\Users\svandebor\Documents\Arduino\hardware\megaTinyCore\megaavr\cores\arduino\wiring.c:75:0: error: unterminated #if

#if defined(MILLIS_USE_TIMERA0)

Figure out how to move variant.c to core

There are no differences between the variants in this core, nor will there be, with regards to what needs to be in this file. But if I simply move variant.c into the core, it builds, but no code appears to execute.

make A# constants visible from the sketch

More mop-up of the moronic analog pin naming baggage imported from the official core.

We got rid of the lookup table for analog channels.

digitalPinToAnalogInput is probably all we need here? But someone needs to dig into how these are used by wiring_analog and hence what they need to be changed to to make them work.

Support for 0-series

I think this may be as simple as dealing with the smaller number of timers? (#16)

Am I missing anything?

Pinout diagrams

This is @MCUdude's department, but I'm going to need his help here. Of course, this is gated by the actual creation of said pinouts!

Improve library examples

Remove ones that aren't good examples and/or which don't compile on parts with small memory.

If this leaves an absence of basic examples, create some.

Fix the pre-processor macro for the digitalPinToAnalogInput(p)

Script for determining the channel for each analog input pin is not correct. I have trouble writing the code for the pre-processor. Pins 0 to 5 should return with 4 to 9 (which works) while 8 and 9 should return 10 and 11, and 14 to 16 is 1 to 3. Currently 8 and 9 return 1 and 2 since that is referring to index 8 and 9 in the PROGMEM analog_pin_to_channel[]
#define digitalPinToAnalogInput(p) (((p) < 6 || (p) == 8 || (p) == 9 || (p) > 13) ? pgm_read_byte(analog_pin_to_channel + p) : NOT_A_PIN)

I can make it work by changing the PROGMEM analog_pin_to_channel[] to:
const uint8_t PROGMEM analog_pin_to_channel[] = { 4, 5, 6, 7, 8, 9, 255, 255, 10, 11, 255, 255, 255, 255, 1, 2, 3 };

But there might be a cleaner solution?

Can we hide non-UPDI programmers?

Make it like non-bootloader chips for ATTinyCore, so programmer is selectable, and will be used for normal upload rather than forcing jtag2updi only.

DAC not implemented

Every ATtiny 1-series supports DAC to write to PA6 for a real analog output. analogWrite only supports PWM at this moment. Should we use analogWrite for the DAC (like it is done on the SAMD) or use something like dacWrite (like the ESP32).

Discussion: Is this the right pin mapping?

Before people actually start using this stuff we should make sure that we've picked a good pin mapping - it's absolute hell to realize later that your pin mapping could have been better, and have to go back and change it (leaving people who are using the core out in the cold), or offer a second pin mapping (confusing new users). Best to put some thought into this now.

The current pin mapping has the advantage of matching the SOIC pinout, so the numbering on a PCB will be continuous. .

On the downside, pins on port A are split between the lowest and highest ports, and most of the pins are numbered in the opposite order as their bit positions, and the analog pin numbers don't match the digital ones, which is a nice feature to have.

Pity they picked PA0 for reset - PB5 (the last bit in a weird 6-bit port) would have been the natural choice IMO.

Support 3217/1617/817/417

As with before, should be reasonably simple, just a pinmapping. but complicated by the fact that the parts come only in awful, inconvenient packages for prototyping.

code styling

We need to run automated tools over the code to do the following:

  • Replace tabs with 2-spaces
  • Ensure trailing newline on all files
  • Ensure no trailing whitespace on any line

This is required when we add automated travis testing.

I think firmwares folder can be removed

That looks like the firmware that goes on the interface chip for 4809 boards, which won't be in use for attiny boards. Stuffing a SAMD microcontroller into a tiny board is contrary to the idea of a small low cost processor.

Support 1614/814/414/214

These are the 14-pin (11GPIO) versions.

I think everything that applies to the x16 series applies here - there don't look to be substantive differences. May just need a pinmapping!

Add menu options

We need a menu option for EESAVE configuration. It should default to enabled.

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.