embeded/arduino(genuino)2017. 12. 28. 23:03

심심해서 짜본

바운서 개조용(?) 아두이노 나노 코드

서보는 D9 핀에 연결하도록 했고

시간은 ms 단위로 최소각도와 최대각도 사이를

편도시간으로 설정하여 반복하도록 작성했음


#include <Servo.h>
Servo servo;
int servoPin = 9;

long swing_period = 3000;
long servo_period = 10;
long swing_count  = 0;
long dir = 0;
long angle = 0;
long min_angle = 45;
long max_angle = 135;
long move_angle = max_angle - min_angle;

void setup() {
  // put your setup code here, to run once:
  servo.attach(servoPin);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (swing_count < swing_period) swing_count += servo_period;
  else
  {
    swing_count = 0;
    if (dir == 0) dir = 1;
    else dir = 0;
  }

  if (dir == 0) // inc
    angle = min_angle + move_angle * swing_count / swing_period;
  else // dec
    angle = max_angle - move_angle * swing_count / swing_period;

  servo.write(angle);
  delay(servo_period);
}



정작 달아 보니

아내 왈 : 왜케 조금 움직여? 걍 떼

... 아놔.. ㅠㅠ



+

2017.12.29

개발자 아빠들이란 ㅋㅋㅋ

일단 우리집에 있는건 저렇게 전체가 흔들리는 버전이 아니라 저걸 적용하기는 무리 ㅋㅋ


[링크 : https://www.youtube.com/watch?v=lr7Dg2AO97c]

[링크 : https://www.youtube.com/watch?v=EmSneb8MVgg]

'embeded > arduino(genuino)' 카테고리의 다른 글

아두이노 미세먼지 센서  (2) 2018.03.30
USB to TTL 정보  (0) 2018.01.10
간만에 지름신  (0) 2017.10.26
릴레이로 AC전원 스위치하기  (0) 2017.10.26
hoverlabs 사의 hover 제품  (0) 2017.07.17
Posted by 구차니

'하드웨어 > 3D 프린터 CNC' 카테고리의 다른 글

3d print z seam(솔기)  (0) 2024.02.22
3D 프린터와 CNC  (0) 2018.01.26
3d 프린터는 물건너 갔으니.. 다른 소재를..  (0) 2017.03.03
3d 프린터가 급 끌리네...  (0) 2017.02.28
Posted by 구차니
embeded/Cortex-M4 Ti2017. 12. 28. 15:01

항상 만만한(?) qs-rgb 예제에서

Linker를 보다 보니... scatter 아래 Misc Control의

--entry Reset_Handler

가 보인다...?



startup_rvmdk.S에

해당 함수가 그럼 entry 포인트로 잡히고

얘는 적절한 초기화 이후 __main 을 호출하게 된다.

;******************************************************************************

;

; This is the code that gets called when the processor first starts execution

; following a reset event.

;

;******************************************************************************

        EXPORT  Reset_Handler

Reset_Handler

        ;

        ; Enable the floating-point unit.  This must be done here to handle the

        ; case where main() uses floating-point and the function prologue saves

        ; floating-point registers (which will fault if floating-point is not

        ; enabled).  Any configuration of the floating-point unit using

        ; DriverLib APIs must be done here prior to the floating-point unit

        ; being enabled.

        ;

        ; Note that this does not use DriverLib since it might not be included

        ; in this project.

        ;

        MOVW    R0, #0xED88

        MOVT    R0, #0xE000

        LDR     R1, [R0]

        ORR     R1, #0x00F00000

        STR     R1, [R0]


        ;

        ; Call the C library enty point that handles startup.  This will copy

        ; the .data section initializers from flash to SRAM and zero fill the

        ; .bss section.

        ;

        IMPORT  __main

        B       __main 


그럼.. main()이 __main 으로 맹글링 되는건가?

[링크 : https://en.wikipedia.org/wiki/Name_mangling]

[링크 : http://spikez.tistory.com/19]

[링크 : http://infocenter.arm.com/help/topic/com.arm.doc.dui0205d/RVCT_Compiler_and_Libraries_D.pdf]

Posted by 구차니
아이디어!2017. 12. 28. 14:10

양덕들 처럼 우리나라도

개발자 덕후들이 놀수 있는 공간이 있음 얼마나 좋을까


[링크 : http://www.edaily.co.kr/news/news_detail.asp?newsId=02610886615929248]

[링크 : http://bizn.donga.com/3/all/20071206/21234324/1]

Posted by 구차니
아이디어!2017. 12. 28. 13:26

애기가 안잔다... -_-

바운서 흔들흔들 해주는 것도 힘들고

그냥 싼 바운서에 덜덜이 켜놔도 별 반응도 없고

발로 흔들흔들해주면 조용해지는데


찾다 보니, 상용제품으로는 있긴한데

[링크 : https://www.4moms.com/]

    [링크 : https://blog.naver.com/kimmihyo/220188986056]


이런 거창한(?)게 아니더라도

바운서 머리쪽에 실을 묶고

바운서 하단 뒤쪽의 철봉 지지대에

서보 모터를 달아서 왔다 갔다 해주면 안되려나?

어짜피 빠를 필요 없고, 이동할 각도가 클 필요가 없으니

RC용 싸구려 서보로도 충분할 듯..

일단 만들어는 봐야겠다 ㅋㅋ



+

[링크 : http://wiki.vctec.co.kr/opensource/arduino/servocontrol]

'아이디어!' 카테고리의 다른 글

멀티채널 ADC와 대역필터  (0) 2018.02.13
공방 하나 만들고 싶다..  (0) 2017.12.28
비트 코인과 CPU의 미래  (0) 2017.12.14
zynq그리고 FPGA 그리고 미래  (2) 2017.12.03
창의력과 거짓  (0) 2017.05.18
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 28. 13:00

큭... VHDL 공부 하는데 Verilog 라니.. 비겁하다!!!


// ============================================================================ // Copyright (c) 2011 by Terasic Technologies Inc. // ============================================================================ // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Terasic Development Boards and Altera Development // Kits made by Terasic. Other use of this code, including the selling // ,duplication, or modification of any portion is strictly prohibited. // // Disclaimer: // // This VHDL/Verilog or C/C++ source code is intended as a design reference // which illustrates how these types of functions can be implemented. // It is the user's responsibility to verify their design for // consistency and functionality through the use of formal // verification methods. Terasic provides no warranty regarding the use // or functionality of this code. // // ============================================================================ // // Terasic Technologies Inc // 356 Fu-Shin E. Rd Sec. 1. JhuBei City, // HsinChu County, Taiwan // 302 // // web: http://www.terasic.com/ // email: support@terasic.com // // ============================================================================ // Major Functions/Design Description: // // Please refer to DE0_Nano_User_manual.pdf in DE0_Nano system CD. // // ============================================================================ // Revision History: // ============================================================================ // Ver.: |Author: |Mod. Date: |Changes Made: // V1.0 |EricChen |02/01/2011 | // ============================================================================ //======================================================= // This code is generated by Terasic System Builder //======================================================= module DE0_NANO( //////////// CLOCK ////////// CLOCK_50, //////////// LED ////////// LED, //////////// KEY ////////// KEY, //////////// SW ////////// SW, //////////// SDRAM ////////// DRAM_ADDR, DRAM_BA, DRAM_CAS_N, DRAM_CKE, DRAM_CLK, DRAM_CS_N, DRAM_DQ, DRAM_DQM, DRAM_RAS_N, DRAM_WE_N, //////////// EPCS ////////// EPCS_ASDO, EPCS_DATA0, EPCS_DCLK, EPCS_NCSO, //////////// Accelerometer and EEPROM ////////// G_SENSOR_CS_N, G_SENSOR_INT, I2C_SCLK, I2C_SDAT, //////////// ADC ////////// ADC_CS_N, ADC_SADDR, ADC_SCLK, ADC_SDAT, //////////// 2x13 GPIO Header ////////// GPIO_2, GPIO_2_IN, //////////// GPIO_0, GPIO_0 connect to GPIO Default ////////// GPIO_0_D, GPIO_0_IN, //////////// GPIO_0, GPIO_1 connect to GPIO Default ////////// GPIO_1_D, GPIO_1_IN, ); //======================================================= // PARAMETER declarations //======================================================= //======================================================= // PORT declarations //======================================================= //////////// CLOCK ////////// input CLOCK_50; //////////// LED ////////// output [7:0] LED; //////////// KEY ////////// input [1:0] KEY; //////////// SW ////////// input [3:0] SW; //////////// SDRAM ////////// output [12:0] DRAM_ADDR; output [1:0] DRAM_BA; output DRAM_CAS_N; output DRAM_CKE; output DRAM_CLK; output DRAM_CS_N; inout [15:0] DRAM_DQ; output [1:0] DRAM_DQM; output DRAM_RAS_N; output DRAM_WE_N; //////////// EPCS ////////// output EPCS_ASDO; input EPCS_DATA0; output EPCS_DCLK; output EPCS_NCSO; //////////// Accelerometer and EEPROM ////////// output G_SENSOR_CS_N; input G_SENSOR_INT; output I2C_SCLK; inout I2C_SDAT; //////////// ADC ////////// output ADC_CS_N; output ADC_SADDR; output ADC_SCLK; input ADC_SDAT; //////////// 2x13 GPIO Header ////////// inout [12:0] GPIO_2; input [2:0] GPIO_2_IN; //////////// GPIO_0, GPIO_0 connect to GPIO Default ////////// inout [33:0] GPIO_0_D; input [1:0] GPIO_0_IN; //////////// GPIO_0, GPIO_1 connect to GPIO Default ////////// inout [33:0] GPIO_1_D; input [1:0] GPIO_1_IN; //======================================================= // REG/WIRE declarations //======================================================= wire reset_n; reg [26:0] counter; reg [5:0] PWM_adj; reg [6:0] PWM_width; reg [7:0] LED; //======================================================= // Structural coding //======================================================= assign reset_n = KEY[0]; always @(posedge CLOCK_50 or negedge reset_n) begin if(!reset_n) begin counter <= 0; LED[0] <= 0; end else begin counter <= counter+1; PWM_width <= PWM_width[5:0]+ PWM_adj; if(counter[26]) begin PWM_adj <= counter[25:20]; end else begin PWM_adj <= ~ counter[25:20]; end LED[0] <= ~PWM_width[6]; LED[1] <= ~PWM_width[6]; LED[2] <= ~PWM_width[6]; LED[3] <= ~PWM_width[6]; LED[4] <= PWM_width[6]; LED[5] <= PWM_width[6]; LED[6] <= PWM_width[6]; LED[7] <= PWM_width[6]; end end endmodule 


일단.. 눈에 들어오는 키워드는

begin - end 구조 동일해 보이고..

postedge CLOCK_50 으로 50Mhz OSC입력을 positive edge 니까.. rising edge일려나?

negedge reset_n 이니까.. KEY_0를 RESET_N으로 맵핑했고(작동이 그러니까..)

그게 falling edge로 잡히면 트리거 되서 작동하는데

!reset_n이면 카운터와 LED[0]을 0으로 각각 셋팅(LED 0번만 끄고 counter를 0으로 설정)

reset_n이면

카운터(27비트 = 134,217,728)를 증가하면서 PWM_Width 값을 더해주는데

카운터의 MSB가 1이 되면 (67,108,864 초과) counter의 25~20번째 비트를 복사하고

0이면 counter의 25~20번째 비트를 negate 시켜서 (그러니까 감소) 복사한다.

그래서 LED[0:7] 에 PWM_width를 입력해 주는데

가장 상위 비트만 출력함으로서

0과 1을 50Mhz에 연동해서 빠르게 on/off 함으로서 PWM을 구현하게 되는건가?



+

posedge means the transition from 0 to 1

negedge the oposit transition from 1 to 0

그러니까.. posedge는 rising edge고, negedge는 falling edge가 맞겠네?

[링크 : http://www.alteraforum.com/forum/showthread.php?t=19611]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

de0-nano + rpi = 채굴머신..  (0) 2017.12.29
de0-nano 기본 예제 올려봄  (0) 2017.12.29
terasic DE0-Nano 부품들  (0) 2017.12.27
quartus2 설치 + usb blaster 설치  (0) 2017.12.27
de0-nano LED 예제  (0) 2017.12.27
Posted by 구차니
embeded/Cortex-M4 Ti2017. 12. 28. 11:33

ICDI로 설정하고 일단은

부트로더 올리고

LM Flash 통해서 0x1000 에 시작 주소가 0x1000으로 바꾼 qs-rgb를 올리니

(Erase Method를 아무생각없이 Entire로 해서 몇번 고생..)

부트로더 안멈추고 바로 qs-rgb로 시작하는데..

부트로더에서 몇 초 기다리게는 못하려나?


올리고 나서 검증을 위해 Flash Utilties에서 부분 삭제를 해보니

부트로더에서 LED 흰색으로 켜지게 해준거 나오는거 봐서..

부팅이 진행가능하면 바로 qs-rgb로 넘어 가는거 같네...

수정한 내용

0x00000000 -> 0x00001000

;******************************************************************************

;

; qs-rgb.sct - Linker configuration file for qs-rgb.

;

; Copyright (c) 2012-2016 Texas Instruments Incorporated.  All rights reserved.

; Software License Agreement

; Texas Instruments (TI) is supplying this software for use solely and

; exclusively on TI's microcontroller products. The software is owned by

; TI and/or its suppliers, and is protected under applicable copyright

; laws. You may not combine this software with "viral" open-source

; software in order to form a larger program.

; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.

; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT

; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR

; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY

; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL

; DAMAGES, FOR ANY REASON WHATSOEVER.

; This is part of revision 2.1.3.156 of the EK-TM4C123GXL Firmware Package.

;

;******************************************************************************


LR_IROM 0x00001000 0x00040000

{

    ;

    ; Specify the Execution Address of the code and the size.

    ;

    ER_IROM 0x00001000 0x00040000

    {

        *.o (RESET, +First)

        * (InRoot$$Sections, +RO)

    }


    ;

    ; Specify the Execution Address of the data area.

    ;

    RW_IRAM 0x20000000 0x00008000

    {

        ;

        ; Uncomment the following line in order to use IntRegister().

        ;

        ;* (vtable, +First)

        * (+RW, +ZI)

    }


+

//*****************************************************************************

//

// Allows an application to perform in-place data decryption during download.

//

// If hooked, this function will be called on receipt of any new block of

// downloaded firmware image data.  The application must decrypt this data

// in place then return at which point the boot loader will write the data to

// flash.

//

// void MyDecryptionFunc(unsigned char *pucBuffer, unsigned long ulSize);

//

// where:

//

// - pucBuffer points to the first byte of data to be decrypted.

// - ulSize indicates the number of bytes of data at pucBuffer.

//

//*****************************************************************************

//#define BL_DECRYPT_FN_HOOK      MyDecryptionFunc 


bl_check.c 소스에서

사용자 함수 확인 부분과 시작 어드레스(기본값은 0x00001000) 에서

바이너리가 존재할 경우 확인하는 부분

uint32_t

CheckForceUpdate(void)

{

#ifdef CHECK_CRC

    uint32_t ui32Retcode;

#endif


#ifdef BL_CHECK_UPDATE_FN_HOOK

    //

    // If the update check function is hooked, call the application to determine

    // how to proceed.

    //

    return(BL_CHECK_UPDATE_FN_HOOK());

#else

    uint32_t *pui32App;


#ifdef ENABLE_UPDATE_CHECK

    g_ui32Forced = 0;

#endif


    //

    // See if the first location is 0xfffffffff or something that does not

    // look like a stack pointer, or if the second location is 0xffffffff or

    // something that does not look like a reset vector.

    //

    pui32App = (uint32_t *)APP_START_ADDRESS;

    if((pui32App[0] == 0xffffffff) ||

       ((pui32App[0] & 0xfff00000) != 0x20000000) ||

       (pui32App[1] == 0xffffffff) ||

       ((pui32App[1] & 0xfff00001) != 0x00000001))

    {

        return(1);

    }

...


빌드된 바이너리 파일을 보면 0x20000df8 이라고 해야하나? 아무튼 이 정보를 가지고 비교하는 듯


Posted by 구차니
embeded/DSP C2000 Ti2017. 12. 28. 09:21

가격이 매너가 없네...

XDS200 이상을 사용하면 될거 같긴한데

호환제품도 드럽게 비싸서.. wiggler 처럼 패러럴 쓰는 염가형은 없나?


[링크 : http://www.tms320.co.kr/shop/goods/goods_view.php?&goodsno=200903031]

[링크 : http://www.tms320.co.kr/shop/goods/goods_view.php?&goodsno=200903075]


TMS320F2808

F280x 시리즈

F2808: 64K x 16 Flash, 18K x 16 SARAM

C28x 계열 아키텍쳐?


5 Device Support

Texas Instruments (TI) offers an extensive line of development tools for the C28x™ generation of DSPs,

including tools to evaluate the performance of the processors, generate code, develop algorithm

implementations, and fully integrate and debug software and hardware modules.

The following products support development of 280x-based applications:

Software Development Tools

• Code Composer Studio™ Integrated Development Environment (IDE)

– C/C++ Compiler

– Code generation tools

– Assembler/Linker

– Cycle Accurate Simulator

• Application algorithms

• Sample applications code

Hardware Development Tools

• 2808 eZdsp™

• Evaluation modules

• JTAG-based emulators - SPI515, XDS510PP, XDS510PP Plus, XDS510USB

• Universal 5-V dc power supply

• Documentation and cables 

[링크 : http://www.ti.com/lit/ds/symlink/tms320f2809.pdf]


XDS 100v2 한 9만원은 생각해야 하네... ㄷㄷ

[링크 : http://eleparts.co.kr/EPX3FY3P] XDS100v2

[링크 : http://eleparts.co.kr/EPX7X37M] XDS100v3

[링크 : http://eleparts.co.kr/EPX86FR7] XDS100v3

[링크 : http://processors.wiki.ti.com/index.php/XDS100]

'embeded > DSP C2000 Ti' 카테고리의 다른 글

CCSv6 설치 시도... 실패 ㅠㅠ  (0) 2018.02.09
Code Composer Studio - CCS  (0) 2018.02.09
xds510usb xds510pp  (0) 2018.02.09
MCU와 DSP 차이점  (0) 2017.12.29
TI TMS320DM368용 JTAG  (0) 2013.07.03
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 27. 21:40

ALTERA EP4C EP4CE22F17C6N Cyclone IV - U1

[링크 : https://www.altera.com/.../global/en_US/pdfs/literature/hb/cyclone-iv/cyiv-51001.pdf


SPANSION FL064PIF 64MBit(8MB) 3.0V SPI FLASH - U9 - EPCS64

악의적이라고 해야하나? 메뉴얼에는 단위가 통일되어 있지 않다.

[링크 : http://www.cypress.com/file/196856/download]


ISSI IS42S16160G-7TLI 256Mb(32MB) SDRAM - U5

[링크 : http://www.issi.com/WW/pdf/42-45S83200G-16160G.pdf]


microchip 24LC02B 2K i2c eeprom - U6

얜... 용도가 멀까? i2c 테스트용?

I2C address 0xA0

[링크 : http://ww1.microchip.com/downloads/en/DeviceDoc/21709c.pdf]


Ti SN74AUC17 슈미트 트리거 버퍼(스위치용) - U2

[링크 : http://www.ti.com/general/docs/lit/getliterature.tsp?genericPartNumber=SN74AUC17&fileType=pdf]


ADXL345 디지털 가속도계 - U3

[링크 : http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf


Ti ADC128S022 8ch, 50kSPS~200kSPS, 12bit ADC - U4

[링크 : http://www.ti.com/general/docs/lit/...genericPartNumber=ADC128S022...pdf


LDO

[링크 : http://www.ti.com/lit/ds/symlink/lp5900.pdf] 3.3V / 1.2V

[링크 : http://www.ti.com/lit/ds/symlink/lp38500-adj.pdf] 2.5V


---

아래 두개는 schematic에서 누락된 부분. USB Blaster 구성품으로 추측된다.


ALTERA EPM240M100C4N MAX II 시리즈 - U8

용도불명 -ㅁ-

[링크 : https://www.altera.com/en_US/pdfs/literature/dp/max2/epm240z.pdf]


FDTI FT245BL - U7

USB to Parallel?

[링크 : http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT245BL.pdf]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

de0-nano 기본 예제 올려봄  (0) 2017.12.29
DE0-nano 기본 프로그램 분석  (0) 2017.12.28
quartus2 설치 + usb blaster 설치  (0) 2017.12.27
de0-nano LED 예제  (0) 2017.12.27
altera 교육자료 요약  (0) 2017.12.27
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 27. 20:48

Quartus Lite 17.1.0.590을 받으면서

ModelSim 도 같이 받았는데 음.. Quartus에 일정부분은 포함되어 있나 보네

그리고 Cyclone IV만 포함되어 있는데.. 내가 선택한건가? 왜 이거 뿐이지?



다 깔고나서 USB Blaster 2 설치하도록 하네..


Altera(WinUSB) JTAG cables라는 이름으로 심심하게(?) 깔린다.


근데 얘는 다른거고.. DE0-nano는 usb blaster라 인식을 안하니까

quartus 2 기본값 설치시 C:\intelFPGA_lite\17.1\quartus\drivers 하위에 드라이버가 존재하고

USB Blaster를 통해 설치하면 된다.

[링크 : https://www.altera.com/support/support-resources/download/drivers/usb-blaster/dri-usb-blaster-vista.html]


+

2017.12.28

tersaic de0-nano\Demonstration\EPCS_Patch\nios2-flash-override.txt

위의 파일은

C:\intelFPGA_lite\17.1\nios2eds\bin 에 복사해주면 된다고 함.

[링크 : https://blog.naver.com/acidc/220616936189]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

DE0-nano 기본 프로그램 분석  (0) 2017.12.28
terasic DE0-Nano 부품들  (0) 2017.12.27
de0-nano LED 예제  (0) 2017.12.27
altera 교육자료 요약  (0) 2017.12.27
GHDL - 시뮬레이터  (0) 2017.12.26
Posted by 구차니