embeded/raspberry pi2017. 3. 25. 13:11

예전에 iot로 검색해서 보다 보니 귀찮고 헷갈려서 다시 정리

PWM은 2개 포트뿐이니.. 동시에 두개가 한계겠네..




rpi.pdf


Posted by 구차니
embeded/Cortex-M3 Ti2017. 3. 24. 10:58

얘랑은 좀 다른 이야기인데...

rs232 to rs485로 쓰다 보니

485쪽은 TXEN 하면 RX쪽이 Hi-Z로 설정되면서

아마도 0x00으로 들어 오는 듯?


그리고 driverlib에도 RX만 disable 시키는 건 없으니

함수를 하나 만들어서 RX만 disable enable을 시켜서 일단 우회

void

UARTDisable(uint32_t ui32Base)

{

    //

    // Check the arguments.

    //

    ASSERT(_UARTBaseValid(ui32Base));


    //

    // Wait for end of TX.

    //

    while(HWREG(ui32Base + UART_O_FR) & UART_FR_BUSY)

    {

    }


    //

    // Disable the FIFO.

    //

    HWREG(ui32Base + UART_O_LCRH) &= ~(UART_LCRH_FEN);


    //

    // Disable the UART.

    //

    HWREG(ui32Base + UART_O_CTL) &= ~(UART_CTL_UARTEN | UART_CTL_TXE |

                                      UART_CTL_RXE);


일단 정석(?)적인 해결책은 RX에 pull-up을 달아 주는 것

[링크 : https://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/t/45318]


OD나 PUD 안먹더라니, 직원이 push-pull로 작동한다고 하면 그런거겠지? ㅠㅠ

[링크 : https://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/t/88669]



9.2.2.27 GPIOPinTypeUART

Configures pin(s) for use by the UART peripheral.

Prototype:

void

GPIOPinTypeUART(unsigned long ulPort,

unsigned char ucPins)

Parameters:

ulPort is the base address of the GPIO port.

ucPins is the bit-packed representation of the pin(s).

Description:

The UART pins must be properly configured for the UART peripheral to function correctly. This

function provides a typical configuration for those pin(s); other configurations may work as well

depending upon the board setup (for example, using the on-chip pull-ups).

The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to

be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO

port pin 1, and so on.

Note:

This cannot be used to turn any pin into a UART pin; it only configures a UART pin for proper

operation. 


Posted by 구차니
embeded/Cortex-M3 Ti2017. 3. 23. 14:21

uart의 baudrate를 설정해주는 녀석은

내부적으로 UARTDisable()과 UARTEnable()을 포함하는데

UARTEnable()은 fifo enable을 포함한다.(얘가 악의 축)


그리고 UARTDisable()은 TX 할게 있으면 다 보낼때 까지 기다려주는 역활을 한다.



void

UARTConfigSetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk,

                    uint32_t ui32Baud, uint32_t ui32Config)

{

    // Stop the UART.

    UARTDisable(ui32Base);


    // Set the baud rate.

    HWREG(ui32Base + UART_O_IBRD) = ui32Div / 64;

    HWREG(ui32Base + UART_O_FBRD) = ui32Div % 64;


    // Set parity, data length, and number of stop bits.

    HWREG(ui32Base + UART_O_LCRH) = ui32Config;


    // Clear the flags register.

    HWREG(ui32Base + UART_O_FR) = 0;


    // Start the UART.

    UARTEnable(ui32Base);


void

UARTEnable(uint32_t ui32Base)

{

    //

    // Check the arguments.

    //

    ASSERT(_UARTBaseValid(ui32Base));


    //

    // Enable the FIFO.

    //

    HWREG(ui32Base + UART_O_LCRH) |= UART_LCRH_FEN;


    //

    // Enable RX, TX, and the UART.

    //

    HWREG(ui32Base + UART_O_CTL) |= (UART_CTL_UARTEN | UART_CTL_TXE |

                                     UART_CTL_RXE);

}


void
UARTDisable(uint32_t ui32Base)
{
    //
    // Check the arguments.
    //
    ASSERT(_UARTBaseValid(ui32Base));

    //
    // Wait for end of TX.
    //
    while(HWREG(ui32Base + UART_O_FR) & UART_FR_BUSY)
    {
    }

    //
    // Disable the FIFO.
    //
    HWREG(ui32Base + UART_O_LCRH) &= ~(UART_LCRH_FEN);

    //
    // Disable the UART.
    //
    HWREG(ui32Base + UART_O_CTL) &= ~(UART_CTL_UARTEN | UART_CTL_TXE |
                                      UART_CTL_RXE);
}



근데 도대체!!! 뒤에 0x00은 왜 붙는거야?

Posted by 구차니
프로그램 사용/sqlite2017. 3. 23. 13:36

쿨 메신저라는 녀석을 백업하면 udb라고 나온다는데

파일 열어 보니 sqllite


그래서 검색을 해보니.. 이거 열어 보는 프로그램이 존재하네?


[링크 : http://sqlitebrowser.org/]

    [링크 : http://aspdotnet.tistory.com/1285]

'프로그램 사용 > sqlite' 카테고리의 다른 글

sqlite primary key  (0) 2019.03.12
sqlite dateime  (0) 2018.11.27
sqlite3 도움말  (0) 2017.04.02
라즈베리 sqlite 버전  (0) 2017.04.02
sqlite  (0) 2013.07.19
Posted by 구차니

/etc/webalizer/webalizer.conf 에 보면 아래 세가지가 보이는데

생각을 해보니.. 이 기능을 이용하면 logrotate를 비활성화 하지 않아도 문제가 될거 없는 느낌?

logrotate를 잠시 꺼둔 이유가 모이지 않아서였는데


history 파일은 이전달들이니까.. 복수형인거 같고

즉, logrotate 당해도 이전 데이터 들은 남아 있다 정도일거 같은데


incremental은 파싱할 내용의 범위를 줄여주는 기능이려나?


 45 # HistoryName allows you to specify the name of the history file produced

 46 # by the Webalizer.  The history file keeps the data for previous months,

 47 # and is used for generating the main HTML page (index.html). The default

 48 # is a file named "webalizer.hist", stored in the output directory being

 49 # used.  The name can include a path, which will be relative to the output

 50 # directory unless absolute (starts with a leading '/')


 54 # Incremental processing allows multiple partial log files to be used

 55 # instead of one huge one.  Useful for large sites that have to rotate

 56 # their log files more than once a month.  The Webalizer will save its

 57 # internal state before exiting, and restore it the next time run, in

 58 # order to continue processing where it left off.  This mode also causes

 59 # The Webalizer to scan for and ignore duplicate records (records already

 60 # processed by a previous run).  See the README file for additional

 61 # information.  The value may be 'yes' or 'no', with a default of 'no'.

 62 # The file 'webalizer.current' is used to store the current state data,

 63 # and is located in the output directory of the program (unless changed

 64 # with the IncrementalName option below).  Please read at least the section

 65 # on Incremental processing in the README file before you enable this option

 

 69 # IncrementalName allows you to specify the filename for saving the

 70 # incremental data in.  It is similar to the HistoryName option where the

 71 # name is relative to the specified output directory, unless an absolute

 72 # filename is specified.  The default is a file named "webalizer.current"

 73 # kept in the normal output directory.  If you don't specify "Incremental"

 74 # as 'yes' then this option has no meaning. 



[링크 : http://se.uzoogom.com/17]

[링크 : http://blog.naver.com/fogwhite/20050962196]



+

그나저나.. 이게 원래 보던건데..


테스트 한다고 access.log 를 비워버리고 webalizer 실행하니까 이렇게 kB In/Out 이라는 못보던 항목이 생겨났다

무슨 옵션으로 인해 생겨난거지?


Posted by 구차니

많이 쓰는게 N-8-1 이니까

1byte 전송에 10bit를 주로 쓰니까 일단 둘다 계산



많이 사용되는(?) 비트레이트 저장

[링크 : http://www.cermetek.com/Catalog/High-Speed-Modems/DataSheet/...CH1794_607-0003/]

Posted by 구차니
embeded/Cortex-M3 Ti2017. 3. 15. 10:07

테스트 코드

19200bps와 38400bps를 오가면서 1바이트씩 보내는 예제


  SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);

GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);


while(1)

{

UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), 19200, UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE);

UARTCharPut(UART1_BASE,'A');

MDINDLY_mSec(100);

UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), 38400, UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE);

UARTCharPut(UART1_BASE,'B');

MDINDLY_mSec(100);

}



근데 도대체.. 예전에는 왜 안되었던 거지??


+

추가로

FIFO 설정은 UARTConfigSetExpClk 에서 무조건 Enable 시키니 주의

Posted by 구차니

약간의 제약이 있긴 하지만

view로 만든 것으로도 insert가 가능하군.


[링크 : http://recoveryman.tistory.com/181]


+

2017.04.07


볼수 있는건 다 뷰로 만들수 있는듯 조인도 되고


[링크 : https://dev.mysql.com/doc/refman/5.7/en/create-view.html]

[링크 : http://stackoverflow.com/questions/12352048/mysql-create-view-joining-two-tables]

'프로그램 사용 > mysql & mariaDB' 카테고리의 다른 글

db에 mac / ip 저장하기(자료형)  (0) 2017.05.09
mysql innodb compress  (0) 2017.04.12
db designer  (0) 2017.03.14
데이터베이스 구조 버전관리  (0) 2017.02.13
mysql 통화관련 변수타입  (0) 2017.02.07
Posted by 구차니
Programming/php2017. 3. 14. 19:02

php 에서는 삽입후 해당 id값을 받을수 있는데

mysql에서 sql로 할때는 어떻게 해야 하려나?


[링크 : http://php.net/manual/kr/function.mysql-insert-id.php]


http://adgw.tistory.com/m/entry/%EA%B3%84%EC%B8%B5%ED%98%95-%EA%B2%8C%EC%8B%9C%ED%8C%90-%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EB%8C%93%EA%B8%80-%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98


5.20

http://stackoverflow.com/questions/15821532/get-current-auto-increment-value-for-any-table

'Programming > php' 카테고리의 다른 글

php 세션주의사항(?)  (0) 2017.04.13
php mvc 구현(+ PDO)  (2) 2017.04.07
php zend guard ?  (2) 2017.03.14
php -> exe (윈도우)  (0) 2017.03.14
php $_REQUEST  (0) 2017.01.25
Posted by 구차니

mysql 디자인 해서 좀 편하게 하고 이력남겨 볼까 했는데

아주 구버전인거 같고 유지보수가 안되는 것 같아서 고민..


[링크 : https://blog.outsider.ne.kr/286]

[링크 : http://fabforce.eu/dbdesigner4/]

'프로그램 사용 > mysql & mariaDB' 카테고리의 다른 글

mysql innodb compress  (0) 2017.04.12
mysql view  (0) 2017.03.14
데이터베이스 구조 버전관리  (0) 2017.02.13
mysql 통화관련 변수타입  (0) 2017.02.07
mysql 다국어 문자길이  (0) 2017.02.06
Posted by 구차니