Embedded programming

Global Review:

Question to Neil: Add google Calender Event, through press of button

https://developers.google.com/calendar/v3/reference/events/insert

Regional Review:

WiFi enabled chips:

nRF52

esp8266

esp32

ESP

https://www.youtube.com/watch?v=ZFgh2KFLeGA

Environments:

NEW: RaspBerry Pi:

https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi/overview

Other Architectrures: - working with other internal architecture

NEW: 32Bit, ESP8266 - check if Neils has some

http://fab.cba.mit.edu/classes/863.15/doc/tutorials/programming/ESP8266/index.html

http://fab.cba.mit.edu/classes/863.14/people/palash_nandy/week11.html

http://fab.cba.mit.edu/classes/863.15/doc/tutorials/programming/ESP8266/index.html

http://fab.cba.mit.edu/classes/865.15/people/dan.chen/esp8266/

http://fab.cba.mit.edu/classes/865.15/people/tomer.weller/2015/04/27/week9-wifi/

http://fab.cba.mit.edu/classes/863.14/people/tomoaki_masuda/w12.html

Check the Network page

ESP8266 (2.4 GHz Wi-Fi)

Software:

Arduino

C+ C-code

NEW: SparkFuns software.... follow examples

This guide:

http://highlowtech.org/?p=1695

To find pinnumber etc.

Lindas (2014) tutorial:

http://fabacademy.org/archives/2014/students/wanders.linda/wk-8.html

Attiny DataSheet

http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7701_Automotive-Microcontrollers-ATtiny24-44-84_Datasheet.pdf

To find: I/O ports

PORTB (bits)

FuseCalculator

http://www.engbedded.com/fusecalc/

To be set once

Once set - it will work in a certain way

Others fuse-setting, can be understund by filling out 6 digits in the "Current settings" part.

FabAcademy Tuturial:

Attiny C

http://fabacademy.org/2018/docs/FabAcademy-Tutorials/week8_embedded_programming/attiny_c.html

Attiny Arduino

http://fabacademy.org/2018/docs/FabAcademy-Tutorials/week8_embedded_programming/attiny_arduino.html

Attiny Fuses

http://fabacademy.org/2018/docs/FabAcademy-Tutorials/week8_embedded_programming/attiny44_fuses.html

Timer:

http://fabacademy.org/2018/docs/FabAcademy-Tutorials/week8_embedded_programming/timing.html

Arduino vs Sorucecode:

Find sourcecode behind Arduino commands:

What is behind digitalWrite:

https://www.arduino.cc/reference/en/language/functions/digital-io/digitalwrite/

Steps:

Connecting HelloEcho

Burnloader set the fuses - only once

-Load Arduino Code

Load C-code

The Attiny works on a 1MHz clock

== Is equal - if it is equal to

= equal to

!= not qual to

Smaller / greater

Pins:

Splits in two:

  • Data Direction Registre - is data going in or out.

  • The port

Neils code:

#define led_port PORTB

#define led_direction DDRB

#define led_pin (1 << PB5) - 1 bin in the port registre

C-code:

Or is a vertical line

What Arduino DigitalWrite actually does - and thus need to be done i C-code:

https://garretlab.web.fc2.com/en/arduino/inside/arduino/wiring_digital.c/digitalWrite.html

Send C-Code:

http://academy.kaziunas.com/tutorials/hello_echo_c.php

Anna Kaziunas France - Fab Academy AS220 Providence, RI - March 2012

sudo make -f hello.arduino.t44.blink.make program-usbtiny

See Lindas log 2014 week 8

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px}
span.s1 {font-variant-ligatures: no-common-ligatures}
span.Apple-tab-span {white-space:pre}

Last login: Thu Mar 15 10:17:02 on ttys000

Familiens-MacBook-Pro:~ nicolaisens$ cd /Users/nicolaisens/Desktop/Arduino Code

Familiens-MacBook-Pro:Arduino Code nicolaisens$ ls

hello.arduino.t44.blink.c hello.arduino.t44.blink.make

Familiens-MacBook-Pro:Arduino Code nicolaisens$ s

-bash: s: command not found

Familiens-MacBook-Pro:Arduino Code nicolaisens$ udo make -f hello.arduino.t44.blink.make program-usbtiny

-bash: udo: command not found

Familiens-MacBook-Pro:Arduino Code nicolaisens$ sudo make -f hello.arduino.t44.blink.make program-usbtiny

Password:

make: *** No rule to make target `program-usbtiny'. Stop.

Familiens-MacBook-Pro:Arduino Code nicolaisens$ sudo make -f hello.arduino.t44.blink.make program-usbtiny

Password:

make: *** No rule to make target `program-usbtiny'. Stop.

Familiens-MacBook-Pro:Arduino Code nicolaisens$ ls

hello.arduino.t44.blink.c.hex.c hello.arduino.t44.blink.make

Familiens-MacBook-Pro:Arduino Code nicolaisens$ ls

hello.arduino.t44.blink.c hello.arduino.t44.blink.make

Familiens-MacBook-Pro:Arduino Code nicolaisens$ sudo make -f hello.arduino.t44.blink.make program-usbtiny

make: *** No rule to make target `program-usbtiny'. Stop.

Familiens-MacBook-Pro:Arduino Code nicolaisens$ sudo make -f hello.arduino.t44.blink.make program-usbtiny

avr-gcc -mmcu=attiny44 -Wall -Os -DF_CPU=2000000 -I./ -o hello.arduino.t44.blink.out hello.arduino.t44.blink.c

avr-objcopy -O ihex hello.arduino.t44.blink.out hello.arduino.t44.blink.c.hex;\

avr-size --mcu=attiny44 --format=avr hello.arduino.t44.blink.out

AVR Memory Usage


Device: attiny44

Program: 96 bytes (2.3% Full)

(.text + .data + .bootloader)

Data: 0 bytes (0.0% Full)

(.data + .bss + .noinit)

avrdude -p t44 -P usb -c usbtiny -U flash:w:hello.arduino.t44.blink.c.hex

avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)

avrdude done. Thank you.

make: *** [program-usbtiny] Error 1

Familiens-MacBook-Pro:Arduino Code nicolaisens$ avrdude -c usbtiny -p t44

avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)

avrdude done. Thank you.

Familiens-MacBook-Pro:Arduino Code nicolaisens$ avrdude -c usbtiny -p t44

avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)

avrdude done. Thank you.

Familiens-MacBook-Pro:Arduino Code nicolaisens$ avrdude -c usbtiny -p t44

avrdude: initialization failed, rc=-1

Double check connections and try again, or use -F to override

this check.

avrdude done. Thank you.

$ avrdude -c usbtiny -p t44

avrdude: initialization failed, rc=-1

Double check connections and try again, or use -F to override this check.

avrdude done. Thank you.

$ avrdude -c usbtiny -p t44

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9207

avrdude: safemode: Fuses OK (H:FF, E:DF, L:FE)

avrdude done. Thank you.

C-code:

$ sudo make -f hello.arduino.t44.blink.make program-usbtiny

avr-objcopy -O ihex hello.arduino.t44.blink.out hello.arduino.t44.blink.c.hex;\

avr-size --mcu=attiny44 --format=avr hello.arduino.t44.blink.out

AVR Memory Usage

Device: attiny44

Program: 96 bytes (2.3% Full)

(.text + .data + .bootloader)

Data: 0 bytes (0.0% Full)

(.data + .bss + .noinit)

avrdude -p t44 -P usb -c usbtiny -U flash:w:hello.arduino.t44.blink.c.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9207

avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed

To disable this feature, specify the -D option.

avrdude: erasing chip

avrdude: reading input file "hello.arduino.t44.blink.c.hex"

avrdude: input file hello.arduino.t44.blink.c.hex auto detected as Intel Hex

avrdude: writing flash (96 bytes):

Writing | ################################################## | 100% 0.19s

avrdude: 96 bytes of flash written

avrdude: verifying flash memory against hello.arduino.t44.blink.c.hex:

avrdude: load data flash data from input file hello.arduino.t44.blink.c.hex:

avrdude: input file hello.arduino.t44.blink.c.hex auto detected as Intel Hex

avrdude: input file hello.arduino.t44.blink.c.hex contains 96 bytes

avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.22s

avrdude: verifying ...

avrdude: 96 bytes of flash verified

avrdude: safemode: Fuses OK (H:FF, E:DF, L:FE)

avrdude done. Thank you.

Familiens-MacBook-Pro:Arduino Code nicolaisens$

sudo make -f hello.arduino.t44.blink.make program-usbtiny

Notes:

results for ""

    No results matching ""