ATTINY85
[
Пред. ] [ Содержание ] [
След. ]
ATTINY85
Created Четверг 10 мая 2018
https://raw.githubusercontent.com/digistump/arduino-boards-index/master/package_digistump_index.json https://digistump.com/wiki/digispark/tutorials/linuxtroubleshooting cheap rf433 temperature sensor (oregon 2.1 compatible) using an ATTINY85 http://labalec.fr/erwan/?p=1520 ATTINY85 RING WATCH http://www.instructables.com/id/ATtiny85-Ring-Watch/ Настройка Arduino IDE в Linux и добавление поддержки семейства ATTiny. https://www.drive2.ru/b/478047865621446767/ Настройка среды и работа с программаторами для AVR микроконтроллеров в Linux https://ph0en1x.net/78-configuring-and-working-with-avr-programmers-in-linux.html#gromov-programmer-configuring Считывание Flash для программатора USBAsp: avrdude -p m8 -c usbasp -P usb -U flash:r:/tmp/m8chip_flash_dump.hex:i
Запись прошивки во Flash для программатора USBAsp: avrdude -p m8 -c usbasp -P usb -U flash:w:/tmp/test_program.hex
Digispark ATtiny85 http://arduino.ru/forum/obshchii/digispark-attiny85?page=1 Скачал старую версию IDE (DigisparkArduino-Win32-1.0.4-May19.zip)
отсюда, распаковал в папку.
Там файл boards.txt как раз такой же, как в видео. Отредактировал его в соответствии с этой видео-инструкцией.
01Было:
02digispark-tiny.name=Digispark (Tiny Core)
03digispark-tiny.upload.maximum_size=6012
04digispark-tiny.build.mcu=attiny85
05digispark-tiny.build.f_cpu=16500000L
06digispark-tiny.build.core=tiny
07digispark-tiny.upload.using=digispark
08digispark-tiny.bootloader.low_fuses=0xf1
09digispark-tiny.bootloader.high_fuses=0x5f
10digispark-tiny.bootloader.extended_fuses=0xfe
11digispark-tiny.bootloader.path=micronucleus
12digispark-tiny.bootloader.file=micronucleus-1.06-upgrade.hex
13
14Стало:
15digispark-tiny.name=Digispark (Tiny Core)
16digispark-tiny.upload.maximum_size=6012
17digispark-tiny.build.mcu=attiny85
18digispark-tiny.build.f_cpu=16500000L
19digispark-tiny.build.core=tiny
20digispark-tiny.upload.using=digispark
21digispark-tiny.bootloader.low_fuses=0xe1
22digispark-tiny.bootloader.high_fuses=0xdd
23digispark-tiny.bootloader.extended_fuses=0xfe
24digispark-tiny.bootloader.path=micronucleus
25digispark-tiny.bootloader.file=micronucleus-1.06.hex
Файл с загрузчиком micronucleus-1.06.hex взял
отсюда.
Залил в UNO скетч из примеров ArduinoISP.
Подключил UNO к Digispark так, как описал уважаемый Sembior.
В IDE 1.0.4 выбрал плату Digispark (Tiny Core), программатор Arduino as ISP.
Нажал Сервис - Записать загрузчик.
После этого через Arduino IDE 1.6.12 скетчи заливаются, как и раньше.
p.s. залил этим же способом бутлоадер t85_default.hex самой свежей версии
отсюда, всё также работает корректно.
работоспособности bootloadera на digisparke attiny85. После того как мне пришел USBasp, прочитал фьюзы там стояли по
умолчанию с завода.
Lock byte 3F оставил как есть 3F
LB2 1 оставил 1
LB1 1 оставил 1
можно считать свою прошивку, если в 1.
Fuse High Byte D7 поменял на
DD RSTDISBL 1 оставил 1 ножка сброса работает только на сброс, как порт нет
DWEN 1 оставил 1 отладка запрещена
SPIEN 0 оставил 0 SPI обмен по последовательному программированию и обмену данными разрешен
WDTON 1 оставил 1 Watchdog таймер запрещен
EESAVE 1 оставил 1 EEPROM при стирании чипа не сохраняется
BODLEVEL2 1 оставил 1 Детектирования снижения питания было запрещено, поставил срабатывание на 2,7v
BODLEVEL1 1 поменял 0 Детектирования снижения питания было запрещено, поставил срабатывание на 2,7v
BODLEVEL0 1 оставил 1 Детектирования снижения питания было запрещено, поставил срабатывание на 2,7v
Fuse Low Byte E2 поменял на
E1 CKDIV8 1 оставил 1 Деление тактовой частоты 8мГц на 8, чтобы работало на 1 мГц. Запрещено.
CKOUT 1 оставил 1 С ножки CLKO выход тактовой частоты. Запрещено.
SUT1 1 оставил 1 Задержка при запуске 14 тактов плюс 64 милисекунды
SUT0 0 оставил 0 Задержка при запуске 14 тактов плюс 64 милисекунды
CKSEL3 0 оставил 0 Внутренний генератор на 8мгц было, выставил на внутренний генератор с умноженем стало 16мГц
CKSEL2 0 оставил 0 Внутренний генератор на 8мгц было, выставил на внутренний генератор с умноженем стало 16мГц
CKSEL1 1 поменял 0 Внутренний генератор на 8мгц было, выставил на внутренний генератор с умноженем стало 16мГц
CKSEL0 0 поменял 1 Внутренний генератор на 8мгц было, выставил на внутренний генератор с умноженем стало 16мГц
Fuse Extended FF поменял на
FE SELFPRGEN 1 поменял на 0 стоял запрет на самопрограммирование, разрешил его.
Поменял фьюзы и после подключения digisparka attiny85 к USB начал определяться в сиситеме, установились драйвера. С помощью Arduino IDE теперь
MOSI (Pin1) from the programmer to MOSI (PB0) on the chip
MISO (Pin9) from the programmer to MISO (PB1) on the chip
RES (Pin5) from the programmer to RESET (PB5) on the chip
SCK (Pin7) from the programmer to SCK (PB2) on the chip
VCC (VTG Pin2) from the programmer to VCC on the chip
GND (Pin4,6,8,10) from the programmer to GND on the chip
ATtiny Pin 7 to Arduino Pin 13 (SCK)
ATtiny Pin 6 to Arduino Pin 12 (MISO)
ATtiny Pin 5 to Arduino Pin 11 (MOSI)
ATtiny Pin 1 to Arduino Pin10 (RESET)
ATtiny Pin 8 to Arduino +5v (Vcc)
ATtiny Pin 4 to Arduino GND (Ground)
avrdude -P comport -b 19200 -c avrisp -p attiny85 -v -e -U flash:w:hexfilename.hex Works really well. The hardest part is to put the paths for the cmd command correctly. I recommed create a folder named Temp and put avrdude.conf and t85_default.hex inside. The command, in my case, is this: C:\"Program Files (x86)"\Arduino\hardware\tools\avr\bin\avrdude -CC:\Temp\avrdude.conf -v -pattiny85 -cstk500v1 -PCOM6 -b19200 -Uflash:w:C:\Temp\t85_default.hex:i -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m Digispark-SNES-Controller https://gitlab.com/cpttobi/Digispark-SNES-Controller Use a Digispark (ATTiny85 dev board with micronucleus bootloader) to connect a Super Nintendo (SNES) controller to a computer via USB.
Wiring
The SNES controller has a 7 pin connector, but only 5 of those are connected. This diagram should help you with wiring it up to your Digispark:
_________________
| o o o o | o o o )
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
1 2 3 4 5 6 7
Pin | Description | Short | Wire color (usually)
1 5 Volt supply 5V
White 2 Data Clock CLK
Yellow 3 Data Latch PS
Orange 4 Serial Data DAT
Red 5 Not Connected - -
6 Not Connected - -
7 Ground GND
Brown Connect +5V and GND to the corresponding pins on your Digispark and the other 3 pins to pins 0, 1, and 2 (you can also use pin 5, but not 3 and 4, they are used for USB).
Then configure the pin numbers (DAT, PS, and CLK) in the Arduino source code to match how you connected them.
https://tinusaur.org/projects/ssd1306xled/ How to use it
Using this library to control an OLDE display is very easy. The necessary header files that should be included with the program could be found in the source code repository – the link is at the bottom of this document.
First, the controlling PINs should be specified in the source code:
#define SSD1306_SCL PB2 // SCL, Pin 3 on SSD1306 Board
#define SSD1306_SDA PB0 // SDA, Pin 4 on SSD1306 Board
There are defaults, of course, but make sure they work for you.
There is also I2C slave address specified in the source code but you probably don’t want to change that.
Second, the display controller should be initialized.
_delay_ms(40);
ssd1306_init();
The delay is necessary if the initialization is at the beginning of the program. This is required by the SSD1306 circuit as it needs time to initialize itself after power-on.
Then, the simplest example would be to clear the screen (fill it out with blanks) and output some text.
ssd1306_fillscreen(0x00);
ssd1306_setpos(0, 10);
ssd1306_string_font6x8("Hello World!");
The ssd1306_string_font6x8 function call will output at the specified by the ssd1306_setpos function coordinates the provided text using 6×8 character font.
Similarly, a bitmap could be output on the screen with the following code:
ssd1306_draw_bmp(0,0,128,8, img1_128x64c1);
The above function call specifies (0,0) coordinates, width of 128 pixels and height of 8 bytes – 64 pixels.
Содержание