embeded/raspberry pi2021. 9. 29. 16:43

1주일 정도 켜놨더니 USB HUB 가 맛이 가서 장치를 인식하지 않는데

원격접속은 문제가 없어서 의아해 하는 중.

 

rpi 2b는 USB 2.0 HUB에 랜 + USB 4port 허브로 구성된 녀석으로 알고 있었는데

3 이후로 바뀐건지 4부터 바뀐건진 모르겠지만

USB가 죽는다고 원격을 못하는 상황은 아니니 훨신 나은 듯?

 

 

+

전체 회로 공개 안하는걸로 정책이 바뀌었나?

[링크 : https://www.raspberrypi.org/documentation/computers/raspberry-pi.html]

[링크 : https://datasheets.raspberrypi.org/]

 

라즈베리 3b 까지는 USB lan 이었는지 랜포트도 그려져 있지 않은데

3b+ 이후 부터는 랜이 따로 나오는 듯?

rpi 4

GbE / TRD[0123]_[NP]

[링크 : https://datasheets.raspberrypi.org/rpi4/raspberry-pi-4-reduced-schematics.pdf]

bcm54213

https://www.hackster.io/news/meet-the-new-raspberry-pi-4-model-b-9b4698c284

 

rpi 3b+

ETH, PoE , TR[0123][np]

[링크 : https://datasheets.raspberrypi.org/rpi3/raspberry-pi-3-b-plus-reduced-schematics.pdf]

보드에서 방열판 떼어보니 LAN7515칩이 발견됨

Hi-Speed USB 2.0 to 10/100/1000 Gigabit Ethernet controller

[링크 : https://www.microchip.com/en-us/product/LAN7500]

 

rpi 3b

[링크 : https://datasheets.raspberrypi.org/rpi3/raspberry-pi-3-b-reduced-schematics.pdf]

 

rpi 2b

[링크 : https://datasheets.raspberrypi.org/rpi2/raspberry-pi-2-b-reduced-schematics.pdf]

'embeded > raspberry pi' 카테고리의 다른 글

rpi pico usb sound  (0) 2021.11.08
rpi3 2초만에 부팅하기  (0) 2021.10.30
rpi zero otg  (0) 2021.09.27
스피커가 부실했군..  (0) 2021.09.26
rpi 2b g_mass_storage  (0) 2021.09.25
Posted by 구차니
embeded/raspberry pi2021. 9. 27. 18:00

rpi 4 cm 에서 usb를 쓰려면 config.txt에 다음의 내용을 추가해야 하는데

dtoverlay=dwc2,dr_mode=host

 

$ modinfo dwc2
filename:       /lib/modules/5.10.60-v7+/kernel/drivers/usb/dwc2/dwc2.ko
license:        Dual BSD/GPL
author:         Synopsys, Inc.
description:    DESIGNWARE HS OTG Core
license:        Dual BSD/GPL
author:         Matthijs Kooijman <matthijs@stdin.nl>
description:    DESIGNWARE HS OTG Platform Glue
srcversion:     C0FF7C976DCDD3E4810AFB1
alias:          of:N*T*Cst,stm32mp15-hsotgC*
alias:          of:N*T*Cst,stm32mp15-hsotg
alias:          of:N*T*Cst,stm32mp15-fsotgC*
alias:          of:N*T*Cst,stm32mp15-fsotg
alias:          of:N*T*Cst,stm32f7-hsotgC*
alias:          of:N*T*Cst,stm32f7-hsotg
alias:          of:N*T*Cst,stm32f4x9-hsotgC*
alias:          of:N*T*Cst,stm32f4x9-hsotg
alias:          of:N*T*Cst,stm32f4x9-fsotgC*
alias:          of:N*T*Cst,stm32f4x9-fsotg
alias:          of:N*T*Capm,apm82181-dwc-otgC*
alias:          of:N*T*Capm,apm82181-dwc-otg
alias:          of:N*T*Camcc,dwc-otgC*
alias:          of:N*T*Camcc,dwc-otg
alias:          of:N*T*Camlogic,meson-g12a-usbC*
alias:          of:N*T*Camlogic,meson-g12a-usb
alias:          of:N*T*Camlogic,meson-gxbb-usbC*
alias:          of:N*T*Camlogic,meson-gxbb-usb
alias:          of:N*T*Camlogic,meson8b-usbC*
alias:          of:N*T*Camlogic,meson8b-usb
alias:          of:N*T*Camlogic,meson8-usbC*
alias:          of:N*T*Camlogic,meson8-usb
alias:          of:N*T*Csamsung,s3c6400-hsotgC*
alias:          of:N*T*Csamsung,s3c6400-hsotg
alias:          of:N*T*Csnps,dwc2C*
alias:          of:N*T*Csnps,dwc2
alias:          of:N*T*Clantiq,xrx200-usbC*
alias:          of:N*T*Clantiq,xrx200-usb
alias:          of:N*T*Clantiq,arx100-usbC*
alias:          of:N*T*Clantiq,arx100-usb
alias:          of:N*T*Crockchip,rk3066-usbC*
alias:          of:N*T*Crockchip,rk3066-usb
alias:          of:N*T*Chisilicon,hi6220-usbC*
alias:          of:N*T*Chisilicon,hi6220-usb
alias:          of:N*T*Cbrcm,bcm2835-usbC*
alias:          of:N*T*Cbrcm,bcm2835-usb
depends:        udc-core,roles
intree:         Y
name:           dwc2
vermagic:       5.10.60-v7+ SMP mod_unload modversions ARMv7 p2v8
pi@raspberrypi:~ $ modinfo dwc2 -v

 

dtoverlay 상으로는 dr_mode 에 host / peripheral / otg를 넣을수 있다고 한다.

$ sudo dtoverlay -h dwc2
Name:   dwc2

Info:   Selects the dwc2 USB controller driver

Usage:  dtoverlay=dwc2,<param>=<val>

Params: dr_mode                 Dual role mode: "host", "peripheral" or "otg"

        g-rx-fifo-size          Size of rx fifo size in gadget mode

        g-np-tx-fifo-size       Size of non-periodic tx fifo size in gadget
                                mode

 

otg 설정에 주변기기로 인식을 시키네..?

dtoverlay=dwc2,dr_mode=peripheral in file /boot/config.txt.

[링크 : https://gist.github.com/gbaman/50b6cca61dd1c3f88f41]

'embeded > raspberry pi' 카테고리의 다른 글

rpi3 2초만에 부팅하기  (0) 2021.10.30
rpi 4는 USB to Ethernet이 아닌가?  (0) 2021.09.29
스피커가 부실했군..  (0) 2021.09.26
rpi 2b g_mass_storage  (0) 2021.09.25
rpi4에서 gpio readall 실행 안될 때  (0) 2021.09.24
Posted by 구차니
embeded/raspberry pi2021. 9. 26. 17:33

일단 앰프는 class D 앰프고

얘는 PWM 어쩌구 하던데 원리까지 알아보려니 급 귀찮고..

 

The PAM8403 is a 3W, class-D audio amplifier.

[링크 : https://pdf1.alldatasheet.com/datasheet-pdf/view/1132029/DIODES/PAM8403.html]

[링크 : https://blog.naver.com/iknowiknow/40021691136]

 

지금보니 스피커는 0.5W

드라이브는 3W+3W 가능한데 오늘 odroid에 연결해서 5V 어댑터 전원 끌어오니 음질이 썩 나쁘진 않은것 같기도?

0.5W 면은 5V * 0.1A 일텐데, 두개니까 0.2A

전에도 그렇겠지만 딱히 커버 불가능한 수준은 아닌것 같은데 왜였을까..

[링크 : https://blog.naver.com/damtaja/221848352426]

2020.04.17 - [embeded/arduino(genuino)] - PAM8403 3W 스테레오 오디오 앰프

 

다른 저가형 사운드바를 봐도 3W 를 많이 쓰는데 비슷한 등급의 부품을 써서 만드는 것 같네.

'embeded > raspberry pi' 카테고리의 다른 글

rpi 4는 USB to Ethernet이 아닌가?  (0) 2021.09.29
rpi zero otg  (0) 2021.09.27
rpi 2b g_mass_storage  (0) 2021.09.25
rpi4에서 gpio readall 실행 안될 때  (0) 2021.09.24
rpi 4 lirc tx, rx  (0) 2021.09.23
Posted by 구차니
embeded/raspberry pi2021. 9. 25. 00:49

존재는 하는데 쓸 수 있긴 한건가?

$ modinfo g_mass_storage
filename:       /lib/modules/5.10.60-v7+/kernel/drivers/usb/gadget/legacy/g_mass_storage.ko
license:        GPL
author:         Michal Nazarewicz
description:    Mass Storage Gadget
srcversion:     B6D70CE605D2CF6CF116805
depends:        usb_f_mass_storage,libcomposite
intree:         Y
name:           g_mass_storage
vermagic:       5.10.60-v7+ SMP mod_unload modversions ARMv7 p2v8
parm:           idVendor:USB Vendor ID (ushort)
parm:           idProduct:USB Product ID (ushort)
parm:           bcdDevice:USB Device version (BCD) (ushort)
parm:           iSerialNumber:SerialNumber string (charp)
parm:           iManufacturer:USB Manufacturer string (charp)
parm:           iProduct:USB Product string (charp)
parm:           file:names of backing files or devices (array of charp)
parm:           ro:true to force read-only (array of bool)
parm:           removable:true to simulate removable media (array of bool)
parm:           cdrom:true to simulate CD-ROM instead of disk (array of bool)
parm:           nofua:true to ignore SCSI WRITE(10,12) FUA bit (array of bool)
parm:           luns:number of LUNs (uint)
parm:           stall:false to prevent bulk stalls (bool)

 

$ lsmod | grep g_mass
g_mass_storage         16384  0
usb_f_mass_storage     49152  1 g_mass_storage
libcomposite           57344  2 g_mass_storage,usb_f_mass_storage

'embeded > raspberry pi' 카테고리의 다른 글

rpi zero otg  (0) 2021.09.27
스피커가 부실했군..  (0) 2021.09.26
rpi4에서 gpio readall 실행 안될 때  (0) 2021.09.24
rpi 4 lirc tx, rx  (0) 2021.09.23
rpi USB 메모리 스틱처럼 만들기? rpi zero  (0) 2021.09.17
Posted by 구차니
embeded/raspberry pi2021. 9. 24. 10:26

항상 라즈3에서 하다가 라즈4에서 하려니 헉.. 뭥미?

아무튼 유지보수 안한다고 하던 wiringpi까지 업데이트 되어서 패키지 만들 정도라니!

$ gpio readall
Oops - unable to determine board type... model: 17

$ gpio -v
gpio version: 2.50
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: Unknown17, Revision: 02, Memory: 0MB, Maker: Sony
  * Device tree is enabled.
  *--> Raspberry Pi 4 Model B Rev 1.2
  * This Raspberry Pi supports user-level GPIO access.

$ wget https://project-downloads.drogon.net/wiringpi-latest.deb
--2021-09-24 10:25:41--  https://project-downloads.drogon.net/wiringpi-latest.deb
Resolving project-downloads.drogon.net (project-downloads.drogon.net)... 188.246.205.22, 2a03:9800:10:7b::2
Connecting to project-downloads.drogon.net (project-downloads.drogon.net)|188.246.205.22|:443...
connected.
HTTP request sent, awaiting response... 200 OK
Length: 52260 (51K) [application/x-debian-package]
Saving to: ‘wiringpi-latest.deb’

wiringpi-latest.deb    100%[==========================>]  51.04K  59.8KB/s    in 0.9s

2021-09-24 10:25:43 (59.8 KB/s) - ‘wiringpi-latest.deb’ saved [52260/52260]

$ sudo dpkg -i wiringpi-latest.deb
Selecting previously unselected package wiringpi.
(Reading database ... 170594 files and directories currently installed.)
Preparing to unpack wiringpi-latest.deb ...
Unpacking wiringpi (2.52) ...
Setting up wiringpi (2.52) ...
Processing triggers for man-db (2.8.5-2) ...

$ gpio -v
gpio version: 2.52
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: Pi 4B, Revision: 02, Memory: 4096MB, Maker: Sony
  * Device tree is enabled.
  *--> Raspberry Pi 4 Model B Rev 1.2
  * This Raspberry Pi supports user-level GPIO access.

$ gpio readall
 +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5v      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | IN   | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | IN   | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |  OUT | 1 | 11 || 12 | 1 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 1 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+


 

[링크 : http://wiringpi.com/wiringpi-updated-to-2-52-for-the-raspberry-pi-4b/]

   [링크 : https://www.raspberrypi.org/forums/viewtopic.php?t=251297]

[링크 : https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=kiyeonah&logNo=221308783013]

'embeded > raspberry pi' 카테고리의 다른 글

스피커가 부실했군..  (0) 2021.09.26
rpi 2b g_mass_storage  (0) 2021.09.25
rpi 4 lirc tx, rx  (0) 2021.09.23
rpi USB 메모리 스틱처럼 만들기? rpi zero  (0) 2021.09.17
rpi stretch lirc irrecord 실패  (0) 2021.09.16
Posted by 구차니
embeded/raspberry pi2021. 9. 23. 14:43

config.txt에서 gpio-ir 관련해서 두개를 활성화 한다.

rx,tx를 반대로 하는게 영향을 주는진 모르겠지만, 아무튼 바꾸라고 하는데가 많으니 바꾸어서 시도

2018의 경우 lirc-gpio 였나? 이런 명칭인데 2020 이후에는 바뀐 것 같은데 changelog를 좀 추적해 봐야 할 듯.

$ cat /boot/config.txt 
# Uncomment this to enable infrared communication.
dtoverlay=gpio-ir-tx,gpio_pin=17,invert=1
dtoverlay=gpio-ir,gpio_pin=18

 

하드웨어는

gpio 17핀에 IR LED의 +극(좁은 쪽) / GND에 IR LED의 -극(넓은쪽)

gpio 18핀에 IR 리시버의 signal / VCC에 3.3 / GND에 적당히 연결

 

lircd 환경설정은 아래와 같이

device /dev/lirc1 으로 하면 입력은 되는데 출력이 안되는 듯 하다.

그리고 irsend는 output 항목의 socket을 통해 전송하게 되니 참조.

$ cat lirc_options.conf
# These are the default options to lircd, if installed as
# /etc/lirc/lirc_options.conf. See the lircd(8) and lircmd(8)
# manpages for info on the different options.
#
# Some tools including mode2 and irw uses values such as
# driver, device, plugindir and loglevel as fallback values
# in not defined elsewhere.

[lircd]
nodaemon        = False
#driver          = devinput
#device          = auto
driver          = default
device          = /dev/lirc0
output          = /var/run/lirc/lircd
pidfile         = /var/run/lirc/lircd.pid
plugindir       = /usr/lib/arm-linux-gnueabihf/lirc/plugins
permission      = 666
allow-simulate  = No
repeat-max      = 600
#effective-user =
#listen         = [address:]port
#connect        = host[:port]
#loglevel       = 6
#release        = true
#release_suffix = _EVUP
#logfile        = ...
#driver-options = ...

[lircmd]
uinput          = False
nodaemon        = False

# [modinit]
# code = /usr/sbin/modprobe lirc_serial
# code1 = /usr/bin/setfacl -m g:lirc:rw /dev/uinput
# code2 = ...


# [lircd-uinput]
# add-release-events = False
# release-timeout    = 200
# release-suffix     = _EVUP

 

odroid에서 modprobe에서 invert=1을 해서 했었으니 얘도 동일하게 dtoverlay에 invert=1를 추가해서 해보니 성공

$ dtoverlay -h gpio-ir-tx
Name:   gpio-ir-tx

Info:   Use GPIO pin as bit-banged infrared transmitter output.
        This is an alternative to "pwm-ir-tx". gpio-ir-tx doesn't require
        a PWM so it can be used together with onboard analog audio.

Usage:  dtoverlay=gpio-ir-tx,<param>=<val>

Params: gpio_pin                Output GPIO (default 18)

        invert                  "1" = invert the output (make it active-low).
                                Default is "0" (active-high).

 

아래의 명령을 통해서 저장한 리모컨 명령을 전송!

$ irsend send_once samsung key_power -d /var/run/lirc/lircd

 

는 실패 ㅋ

hardware does not support sending

 

의외로 장치를 lirc1으로 하면 tx가 안되는 문제가 있는 것 같아서 /dev/lirc0으로 하니 문제 없이 되네

[링크 : https://www.raspberrypi.org/forums/viewtopic.php?t=263689]

 

+

root 권한이 필요한데

/sys/kernel/debug/gpio 파일을 열어 보면 현재 gpio이 설정 상태를 볼 수 있다.

근데 별.. 도움은 안됨 ㅠㅠ

[링크 : https://youtu.be/TSJ2gYvsVGc?t=59]

 

+

아래는 invert 넣지 않은 것

$ sudo cat  /sys/kernel/debug/gpio
 gpio-17  (GPIO17              |gpio-ir-transmitter@) out lo
 gpio-18  (GPIO18              |ir-receiver@12      ) in  hi IRQ ACTIVE LOW

 

아래는 invert 넣은 것

$ sudo cat  /sys/kernel/debug/gpio
 gpio-17  (GPIO17              |gpio-ir-transmitter@) out hi ACTIVE LOW
 gpio-18  (GPIO18              |ir-receiver@12      ) in  hi IRQ ACTIVE LOW

'embeded > raspberry pi' 카테고리의 다른 글

rpi 2b g_mass_storage  (0) 2021.09.25
rpi4에서 gpio readall 실행 안될 때  (0) 2021.09.24
rpi USB 메모리 스틱처럼 만들기? rpi zero  (0) 2021.09.17
rpi stretch lirc irrecord 실패  (0) 2021.09.16
lirc 제조사별 키코드  (0) 2021.09.16
Posted by 구차니
embeded/raspberry pi2021. 9. 17. 13:46

라즈베리 파이 zero에서 USB 메모리 스틱처럼 인식을 시킬수 있다는데

2B나 3B 등에서는 아무래도 회로적으로 USB OTG 구성이 되어 있지 않으니 안될 것 같고

rpi CM4만 해도 OTG가 굽는 용도로 있으니 어떻게 든 가능할 것 같은데.. 확신은 없음

 

반대로 OTG가 존재하는 odroid 등에서는 가능하려나?

 

$ sudo modprobe g_mass_storage removable=1 ro=1

[링크 : https://www.raspberrypi.org/forums/viewtopic.php?t=223127]

[링크 : https://linuxlink.timesys.com/docs/wiki/engineering/HOWTO_Use_USB_Gadget_File_Storage]

'embeded > raspberry pi' 카테고리의 다른 글

rpi4에서 gpio readall 실행 안될 때  (0) 2021.09.24
rpi 4 lirc tx, rx  (0) 2021.09.23
rpi stretch lirc irrecord 실패  (0) 2021.09.16
lirc 제조사별 키코드  (0) 2021.09.16
lirc를 이용한 리모컨 신호 복제  (0) 2021.09.13
Posted by 구차니
embeded/raspberry pi2021. 9. 16. 19:18

머가 문제일까..

 

[링크 : https://raspberrypi.stackexchange.com/questions/104008/lirc-irrecord-wont-record-buster-mode2-works]

 

+

stretch가 문제가 아니라

decoded에 문제가 있는지 raw로 하니 잘 된다.

'embeded > raspberry pi' 카테고리의 다른 글

rpi 4 lirc tx, rx  (0) 2021.09.23
rpi USB 메모리 스틱처럼 만들기? rpi zero  (0) 2021.09.17
lirc 제조사별 키코드  (0) 2021.09.16
lirc를 이용한 리모컨 신호 복제  (0) 2021.09.13
rpi 에서 ir 읽기  (0) 2021.09.11
Posted by 구차니
embeded/raspberry pi2021. 9. 16. 15:57

'embeded > raspberry pi' 카테고리의 다른 글

rpi USB 메모리 스틱처럼 만들기? rpi zero  (0) 2021.09.17
rpi stretch lirc irrecord 실패  (0) 2021.09.16
lirc를 이용한 리모컨 신호 복제  (0) 2021.09.13
rpi 에서 ir 읽기  (0) 2021.09.11
rpi 3b update, install 실패  (0) 2021.09.10
Posted by 구차니
embeded/raspberry pi2021. 9. 13. 12:00

오.. 귀찮으니 해볼까

 

[링크 : https://www.raspberry-pi-geek.com/Archive/2015/10/Raspberry-Pi-IR-remote]

 

GPIO 18 IR Receiver     (IR RECEIVER)
GPIO 22 IR Transmitter  (IR LED)

$ sudo apt-get install  lirc
$ sudo vim /etc/modules
$ lirc_dev
$ lirc_rpi gpio_in_pin=18 gpio_out_pin=22

[링크 : https://lifeonroom.com/diy/aricon-on-using-lirc/]

'embeded > raspberry pi' 카테고리의 다른 글

rpi stretch lirc irrecord 실패  (0) 2021.09.16
lirc 제조사별 키코드  (0) 2021.09.16
rpi 에서 ir 읽기  (0) 2021.09.11
rpi 3b update, install 실패  (0) 2021.09.10
vc4cl - VideoCore IV OpenCL  (0) 2021.09.09
Posted by 구차니