embeded/Cortex-M4 Ti2016. 4. 12. 08:54

욕같애...

stellarisware가 이름은 더 이뻤는데 흑.. ㅠㅠ



아마도.. 조만간 해야 할일..

stellarisware -> tivaware migration ㅠㅠ




[링크 : http://www.ti.com/lit/an/spma050a/spma050a.pdf]

'embeded > Cortex-M4 Ti' 카테고리의 다른 글

TM4C1231E6PM ADC  (0) 2016.05.20
tm4c1231e6pm / lm3s1607 타이머 차이점...?  (0) 2016.05.06
keil/c99 에서 __inline ...?  (0) 2016.04.12
tm4c1231e6pm DIV400 ?  (0) 2016.04.12
lm3s1607 대체제 검색중..  (0) 2016.04.12
Posted by 구차니
embeded/arduino(genuino)2016. 4. 11. 18:33

믿을만 한건가...?


// Internal Temperature Sensor // Example sketch for ATmega328 types. // // April 2012, Arduino 1.0 void setup() {  Serial.begin(9600);  Serial.println(F("Internal Temperature Sensor")); } void loop() {  // Show the temperature in degrees Celcius.  Serial.println(GetTemp(),1);  delay(1000); } double GetTemp(void) {  unsigned int wADC;  double t;  // The internal temperature has to be used  // with the internal reference of 1.1V.  // Channel 8 can not be selected with  // the analogRead function yet.  // Set the internal reference and mux.  ADMUX = (_BV(REFS1) | _BV(REFS0) | _BV(MUX3));  ADCSRA |= _BV(ADEN);  // enable the ADC  delay(20);            // wait for voltages to become stable.  ADCSRA |= _BV(ADSC);  // Start the ADC  // Detect end-of-conversion  while (bit_is_set(ADCSRA,ADSC));  // Reading register "ADCW" takes care of how to read ADCL and ADCH.  wADC = ADCW;  // The offset of 324.31 could be wrong. It is just an indication.  t = (wADC - 324.31 ) / 1.22;  // The returned temperature is in degrees Celcius.  return (t); }


실내온도 25도

손으로 대면 약간 따스함이 느껴지는걸 봐서는 37도~38도 정도 되지 않을까 싶은데...

19.4도는 손을 댄 시점..

20.2

20.2

20.2

21.1

20.2

20.2

20.2

21.1

20.2

21.1

20.2

20.2

19.4

19.4

18.6

19.4

19.4

20.2

19.4

20.2

21.1

20.2

20.2

20.2

20.2

20.2

20.2

21.1

20.2

21.1

20.2

21.1

20.2


그냥 레지스터 출력

349.0

349.0

349.0

348.0

348.0

348.0

348.0

348.0

349.0

349.0

348.0

349.0

349.0 


[링크 : http://playground.arduino.cc/Main/InternalTemperatureSensor]

2016/03/31 - [embeded/arduino(genuino)] - 아두이노 나노 내장 온도센서



아무튼.. 아래 계산식에 의해 349를 계산해보면

349 = (Vin * 1024) / 1.1

Vin = (349 * 1.1) / 1024

Vin = 0.37490234375 = 374mV 인가?



대충.. 10bit니까 1024.. rev가 1.1로 내장 전원을 쓰니

단순하게(?) 출력으로 나오는 값에서 10으로 나눠주면 되려나?

그런데.. k랑 Tos값은 제품 테스트의 일부로 EEPROM에 테스트 해서 저장해야 한다고?!?!


[링크 : http://www.atmel.com/images/...328p_datasheet_complete.pdf]



[링크 : https://www.arduino.cc/en/uploads/Main/ArduinoNano30Schematic.pdf]


AREF는 0.0V로 연결되서.. 코드에서 내부 1.1V로 설정한 듯?


ADMUX = (_BV(REFS1) | _BV(REFS0) | _BV(MUX3));

Internal 1.1V Voltage Reference with external capacitor at AREF pin



회로도에서 찾아 보니.. AVcc는 5V랑 묶여 있으니..

데이터시트에서 해당내용을 찾아 변경하면..


음.. 너무 빠듯하게 나오네..


ADMUX = (_BV(REFS0) | _BV(MUX3)); // (_BV(REFS1) | 


79.0

79.0

79.0

79.0

79.0

79.0

79.0 



+

offset도 .. gain도 많이 다르네?


static const float offset = 335.2; // change this by calibration result

static const float gain = 1.06154;

[링크 : http://www.avdweb.nl/arduino/hardware-interfacing/temperature-measurement.html]

Posted by 구차니
embeded/arduino(genuino)2016. 4. 9. 23:27

올... 이미 다 설정이 있네? ㄷㄷ

조금 번거로워도.. 거상인 GS-08A Atmega8 을 이걸 가지고

조금 수정해서

3.3V 용으로 퓨즈비트랑 설정한 다음 stk-500 계열로 avrisp 이용해서 구으면 될려나?




[링크 : https://learn.sparkfun.com/tutorials/using-the-arduino-pro-mini-33v]

[링크 : https://www.sparkfun.com/products/11114]

Posted by 구차니
embeded/arduino(genuino)2016. 4. 7. 10:25

기본값으로 설치되었다는 전제하에

아래 경로에 플래시 구울때 사용하는 설정들이 존재한다.


아두이노는 기본적으로 USB 파워나 외부 전원을 통해(7805) 5V를 공급하도록 되어있는데

7805를 들어내거나 결선을 바꾸거나 외부 Vcc에다가 3.3V를 넣어 주고

클럭을 다운시켜 작동하면 좀 간편할지도?


아니면 프로미니 3.3V 이런거라던가?


ATmega328 running at 8MHz with external resonator (0.5% tolerance)

Low-voltage board needs no interfacing circuitry to popular 3.3V devices and modules (GPS, accelerometers, sensors, etc)

[링크 : https://www.sparkfun.com/products/11114]


C:\Program Files (x86)\Arduino\hardware\arduino\avr\boards.txt

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


nano.name=Arduino Nano


nano.upload.tool=avrdude

nano.upload.protocol=arduino


nano.bootloader.tool=avrdude

nano.bootloader.unlock_bits=0x3F

nano.bootloader.lock_bits=0x0F


nano.build.f_cpu=16000000L

nano.build.board=AVR_NANO

nano.build.core=arduino

nano.build.variant=eightanaloginputs


## Arduino Nano w/ ATmega328

## -------------------------

nano.menu.cpu.atmega328=ATmega328


nano.menu.cpu.atmega328.upload.maximum_size=30720

nano.menu.cpu.atmega328.upload.maximum_data_size=2048

nano.menu.cpu.atmega328.upload.speed=57600


nano.menu.cpu.atmega328.bootloader.low_fuses=0xFF

nano.menu.cpu.atmega328.bootloader.high_fuses=0xDA

nano.menu.cpu.atmega328.bootloader.extended_fuses=0x05

nano.menu.cpu.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex


nano.menu.cpu.atmega328.build.mcu=atmega328p


## Arduino Nano w/ ATmega168

## -------------------------

nano.menu.cpu.atmega168=ATmega168


nano.menu.cpu.atmega168.upload.maximum_size=14336

nano.menu.cpu.atmega168.upload.maximum_data_size=1024

nano.menu.cpu.atmega168.upload.speed=19200


nano.menu.cpu.atmega168.bootloader.low_fuses=0xff

nano.menu.cpu.atmega168.bootloader.high_fuses=0xdd

nano.menu.cpu.atmega168.bootloader.extended_fuses=0x00

nano.menu.cpu.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex


nano.menu.cpu.atmega168.build.mcu=atmega168 


[링크 : https://forum.arduino.cc/index.php?topic=236128.0]



Arduino Duemilanove or Nano w/ ATmega328


Low Fuse 0xFF

High Fuse 0xDA

Extended Fuse 0x05 


[링크 : http://www.codingwithcody.com/2011/04/arduino-default-fuse-settings/]

[링크 : http://www.engbedded.com/fusecalc/] 퓨즈비트 계산기



+

어제 퇴근길에 본거 겨우 링크 찾았네..

[링크 : http://www.ba0sh1.com/tutorial-3-3v-hacking-for-arduino-nano/]

Posted by 구차니
embeded/arduino(genuino)2016. 4. 7. 09:58

툴에서 설정을 해놨다면 그걸 이용해서

스케치 - 프로그래머를 이용해 업로드

를 함으로서 stk500 호환 usbisp 등을 이용해 업로드가 가능해진다.





[링크 : https://www.arduino.cc/en/Hacking/Bootloader?from=Tutorial.Bootloader]


Tools->Boards->Your Board

Tools->Programmer->Your Programmer

Sketch->Upload Using a Programmer

[링크 : https://www.arduino.cc/en/Hacking/Programmer]

Posted by 구차니
embeded/arduino(genuino)2016. 4. 6. 23:41



 

예전에 가지고 있던 녀석으로 구워볼려고 했더니..

프로그래머 이녀석은... 굽는 용도가 아닌가? 안되지 왜?

(어쩌면 보드를 정해줘서 그런걸지도..)


아무튼 STK500 개발보드로 하니 USBISP로 구워진다

[링크 : http://www.us-technology.co.kr/product/product_main.asp?mode=5&smode=5]



근데.. 메시지가 머이리 길어?

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500 -PCOM6 -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m


avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2009 Joerg Wunsch


         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"


         Using Port                    : COM6

         Using Programmer              : stk500

         AVR Part                      : ATmega328P

         Chip Erase delay              : 9000 us

         PAGEL                         : PD7

         BS2                           : PC2

         RESET disposition             : dedicated

         RETRY pulse                   : SCK

         serial program mode           : yes

         parallel program mode         : yes

         Timeout                       : 200

         StabDelay                     : 100

         CmdexeDelay                   : 25

         SyncLoops                     : 32

         ByteDelay                     : 0

         PollIndex                     : 3

         PollValue                     : 0x53

         Memory Detail                 :


                                  Block Poll               Page                       Polled

           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack

           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------

           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff

           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff

           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00


         Programmer Type : STK500V2

         Description     : Atmel STK500

         Programmer Model: AVRISP

         Hardware Version: 2

         Firmware Version Master : 2.10

         Vtarget         : 5.0 V

         SCK period      : 43.5 us


avrdude: AVR device initialized and ready to accept instructions


Reading | ################################################## | 100% 0.09s


avrdude: Device signature = 0x1e950f

avrdude: erasing chip

avrdude: reading input file "0x3F"

avrdude: writing lock (1 bytes):


Writing | ################################################## | 100% 0.04s


avrdude: 1 bytes of lock written

avrdude: verifying lock memory against 0x3F:

avrdude: load data lock data from input file 0x3F:

avrdude: input file 0x3F contains 1 bytes

avrdude: reading on-chip lock data:


Reading | ################################################## | 100% 0.03s


avrdude: verifying ...

avrdude: 1 bytes of lock verified

avrdude: reading input file "0x05"

avrdude: writing efuse (1 bytes):


Writing | ################################################## | 100% 0.03s


avrdude: 1 bytes of efuse written

avrdude: verifying efuse memory against 0x05:

avrdude: load data efuse data from input file 0x05:

avrdude: input file 0x05 contains 1 bytes

avrdude: reading on-chip efuse data:


Reading | ################################################## | 100% 0.03s


avrdude: verifying ...

avrdude: 1 bytes of efuse verified

avrdude: reading input file "0xDA"

avrdude: writing hfuse (1 bytes):


Writing | ################################################## | 100% 0.03s


avrdude: 1 bytes of hfuse written

avrdude: verifying hfuse memory against 0xDA:

avrdude: load data hfuse data from input file 0xDA:

avrdude: input file 0xDA contains 1 bytes

avrdude: reading on-chip hfuse data:


Reading | ################################################## | 100% 0.03s


avrdude: verifying ...

avrdude: 1 bytes of hfuse verified

avrdude: reading input file "0xFF"

avrdude: writing lfuse (1 bytes):


Writing | ################################################## | 100% 0.03s


avrdude: 1 bytes of lfuse written

avrdude: verifying lfuse memory against 0xFF:

avrdude: load data lfuse data from input file 0xFF:

avrdude: input file 0xFF contains 1 bytes

avrdude: reading on-chip lfuse data:


Reading | ################################################## | 100% 0.02s


avrdude: verifying ...

avrdude: 1 bytes of lfuse verified


avrdude done.  Thank you.


C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500 -PCOM6 -Uflash:w:C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:i -Ulock:w:0x0F:m 


avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2009 Joerg Wunsch


         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"


         Using Port                    : COM6

         Using Programmer              : stk500

         AVR Part                      : ATmega328P

         Chip Erase delay              : 9000 us

         PAGEL                         : PD7

         BS2                           : PC2

         RESET disposition             : dedicated

         RETRY pulse                   : SCK

         serial program mode           : yes

         parallel program mode         : yes

         Timeout                       : 200

         StabDelay                     : 100

         CmdexeDelay                   : 25

         SyncLoops                     : 32

         ByteDelay                     : 0

         PollIndex                     : 3

         PollValue                     : 0x53

         Memory Detail                 :


                                  Block Poll               Page                       Polled

           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack

           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------

           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff

           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff

           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00


         Programmer Type : STK500V2

         Description     : Atmel STK500

         Programmer Model: AVRISP

         Hardware Version: 2

         Firmware Version Master : 2.10

         Vtarget         : 5.0 V

         SCK period      : 43.5 us


avrdude: AVR device initialized and ready to accept instructions


Reading | ################################################## | 100% 0.09s


avrdude: Device signature = 0x1e950f

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 "C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex"

avrdude: writing flash (32670 bytes):


Writing | ################################################## | 100% 0.00s


avrdude: 32670 bytes of flash written

avrdude: verifying flash memory against C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:

avrdude: load data flash data from input file C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:

avrdude: input file C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex contains 32670 bytes

avrdude: reading on-chip flash data:


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


avrdude: verifying ...

avrdude: 32670 bytes of flash verified

avrdude: reading input file "0x0F"

avrdude: writing lock (1 bytes):


Writing | ################################################## | 100% 0.09s


avrdude: 1 bytes of lock written

avrdude: verifying lock memory against 0x0F:

avrdude: load data lock data from input file 0x0F:

avrdude: input file 0x0F contains 1 bytes

avrdude: reading on-chip lock data:


Reading | ################################################## | 100% 0.04s


avrdude: verifying ...

avrdude: 1 bytes of lock verified


avrdude done.  Thank you. 


Posted by 구차니
embeded/arduino(genuino)2016. 4. 6. 22:59

헐.. 설정이 문제가 아니었나 -ㅁ-?!?!


시리얼 포트를 통해서는 이런 메시지가(115k)

 NON GENUINE DEVICE FOUND! NON GENUINE DEVICE FOUND! 


구을려고 하면 아래와 같은 메시지가 나온다.

avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2009 Joerg Wunsch


         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"


         Using Port                    : COM6

         Using Programmer              : arduino

         Overriding Baud Rate          : 57600

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x43

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x45

avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x20

avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x46

avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x4f

avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x55

avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x4e

avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x44

avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x21

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x20 


얘는 내가 쓰던 usbisp 인데.. 이렇게 나오고..


안구워지는 녀석은.. 이렇게


구워지는 놈은 이렇게... 어?


윈도우 드라이버가 의심되서 봐도 머.. 둘다 상관없네




[링크 : http://www.instructables.com/id/A-solution-to-avrdude-stk500getsync-not-in-syn/]

[링크 : https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader]

[링크 : http://electropit.com/index.php/2015/09/06/arduino-nano-v3-0-clones/]

[링크 : http://internetofhomethings.com/homethings/?tag=not-genuine-device-found]

[링크 : http://www.ftdichip.com/Support/Utilities.htm#FT_PROG]



일단.. 위에 내용을 덮어 쓰고 하니까.

새로운 포트로 잡히고 나서 구워진다.. 머지?


16진수 값으로도 가장 마지막 비트가 먼가 이상한게 씌어져 있을때는 안되었고(무슨값인진..)

0000 으로 되어 있으니 되는걸 봐서는..

의심가는 건.. hardware specific 하위의 RS232와 IO 컨트롤 관련 셋팅..



Posted by 구차니
embeded/raspberry pi2016. 4. 6. 20:06

안된다는 말이 있어서 따라가보니...

핀 자체가 실장이 안되어 있다고... (GPIO19)



bcm2835 has support for I2C slave. Refer to section 11 of http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf


Unfortunately, GPIO pin 19 (BSC slave CLK) was dropped. http://elinux.org/RPi_BCM2835_GPIOs


So, the built-in I2C slave cannot be used.

[링크 : http://raspberrypi.stackexchange.com/questions/5584/i2c-raspberri-pi-as-a-slave]





[링크 : http://elinux.org/RPi_BCM2835_GPIOs]

Posted by 구차니
embeded/arduino(genuino)2016. 4. 6. 20:01

라즈베리는 3.3v 일테고

아두이노는 5v 일텐데.. 그냥 연결해도 되려나?

라즈베리 날려먹긴 싫은데.. 레벨 시프터 사야하나 ㅠㅠ


[링크 : https://www.eleparts.co.kr/EPX8MXNR] 6천원... ㅠㅠ


일단은...

아래는 3.3V 짜리를 5V인 아두이노에서 쓰는거지만...

[링크 : http://playground.arduino.cc/Main/I2CBi-directionalLevelShifter]

2016/04/01 - [embeded/arduino(genuino)] - 아두이노 level shift / MPU-6050


The Raspberry Pi is running at 3.3 Volts while the Arduino is running at 5 Volts. There are tutorials suggest using a level converter for the I2C communication. This is NOT needed if the Raspberry Pi is running as “master” and the Arduino is running as “slave”.


The reason it works is because the Arduino does not have any pull-ups resistors installed, but the P1 header on the Raspberry Pi has 1k8 ohms resistors to the 3.3 volts power rail. Data is transmitted by pulling the lines to 0v, for a “high” logic signal. For “low” logic signal, it’s pulled up to the supply rail voltage level. Because there is no pull-up resistors in the Arduino and because 3.3 volts is within the “low” logic level range for the Arduino everything works as it should.

[링크 : http://blog.oscarliang.net/raspberry-pi-arduino-connected-i2c/]

    [링크 : http://dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors]

[링크 : http://blog.retep.org/2014/02/15/connecting-an-arduino-to-a-raspberry-pi-using-i2c/]




걍.. 과감하게(?) atmega 녀석들이 대부분 2.8V~5.5V 니까 3.3V로 주면 안되려나?


Operating Voltage:

1.8 - 5.5V


TWI(I2C)쪽 입력 전압은 Vcc + 0.5 니까.. 3.3V 주면은.. 어떻게 안되려나?

그나저나.. 0.3V~0.7V 로 무지 좁네..



[링크 : http://www.atmel.com/...atmega48a-48pa-88a-88pa-168a-168pa-328-328p_datasheet_complete.pdf]

Posted by 구차니
embeded/raspberry pi2016. 4. 5. 16:00

음.. FREX 핀은있으나.. 웬지 라즈베리용 카메라에는 FREX를 빼놓지 않았을 기분?



43p



[링크 : http://www.seeedstudio.com/wiki/images/3/3c/Ov5647_full.pdf]

[링크 : http://www.ovt.com/uploads/parts/OV5647.pdf]


어? 120p가 안돼?

Frame rate up to 120 fps

max 90fps. Limitations on frame size for the higher frame rates (VGA only for above 47fps)


그리고.. external / internal sync. 미지원

Support for internal and external frame synchronisation for frame exposure mode

No

[링크 : https://www.raspberrypi.org/documentation/hardware/camera.md]

Posted by 구차니