How can I access GPIO with physical address? - linux-device-driver

I have a requirement that is accessing GPIO with ubuntu 14.04LTS.
Below information is my device information:
OS:Ubuntu 14.04 LTS 64bits
CPU:Intel® Celeron(R) CPU J1900 # 1.99GHz × 4
And bleow link is datasheet and driver code
code and datasheet here.
First I was checked the chip is it8785, and GPIO port is 32 to 39.
PIN of port GPIO 32 is 117, so I type the command:
echo 32 > /sys/class/gpio/export
and
echo 117 > /sys/class/gpio/export
but both show the error "bash - echo: write error: invalid argument"
I don't have any idea for this, so I contect with manufacturer.
They told me that if i want access GPIO, I must direct access CPU address like :
GPIO PORT Adderss
32 0xfed0e388
33 0xfed0e368
34 0xfed0e318
35 0xfed0e378
36 0xfed0e308
37 0xfed0e398
38 0xfed0e328
39 0xfed0e3A8
I have googled for a while, quantity of data are rarly.
It's thanksful for any advice.

Can you try and use sudo while exporting and see if the gpio could exported.
As the manufacturer has provided with register address you can map them to user space and access. On how to access them in user space you can have a look at dev2mem. Hope that helps.

Related

PPPD Connect script failed

I'm using the Raspberry Pi 4 and trying to have an Internet access using the A9G GSM/GPRS+GPS Module.
At first I have install ppp with sudo apt-get install ppp screen elinks
I have create a file with name rnet in path /etc/ppp/peers/rnet:
# My APN internet.vodafone.gr
connect "/usr/sbin/chat -v -f /etc/chatscripts/gprs -T internet.vodafone.gr"
# Communication port:
/dev/ttyS0
# Baudrate
9600
# Assumes that your IP address is allocated dynamically by the ISP.
noipdefault
# Try to get the name server addresses from the ISP.
usepeerdns
# Use this connection as the default route to the internet.
defaultroute
# Makes PPPD "dial again" when the connection is lost.
persist
# Do not ask the remote to authenticate.
noauth
# No hardware flow control on the serial link with GSM Modem
nocrtscts
# No modem control lines with GSM Modem
local
In file gprs in path /etc/chatscripts/gprs I have add the line that need my "MY_4_DIGIT_PIN":
ABORT BUSY
ABORT VOICE
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "NO DIAL TONE"
ABORT "NO ANSWER"
ABORT "DELAYED"
ABORT "ERROR"
# cease if the modem is not attached to the network yet
ABORT "+CGATT: 0"
"" AT
TIMEOUT 12
OK ATH
OK ATE1
# +CPIN provides the SIM card PIN
OK AT+CPIN="MY_4_DIGIT_PIN"
# +CFUN may allow to configure the handset to limit operations to
# GPRS/EDGE/UMTS/etc to save power, but the arguments are not standard
# except for 1 which means "full functionality".
#OK AT+CFUN=1
OK AT+CGDCONT=1,"IP","\T","",0,0
OK ATD*99#
TIMEOUT 22
CONNECT ""
So when I'am trying to starts up the rnet file:
sudo pon rnet
I get this error message in syslog (cat /var/log/syslog | grep pppd):
Oct 14 18:14:22 raspberrypi pppd[3063]: pppd 2.4.7 started by pi, uid 0
Oct 14 18:14:35 raspberrypi pppd[3063]: Connect script failed
Oct 14 18:15:06 raspberrypi pppd[3063]: Connect script failed
Oct 14 18:15:37 raspberrypi pppd[3063]: Connect script failed
...
When I am trying to run the below AT commands, the module seems to be work fine and be able to connected to network:
AT
OK
AT+CPIN?
+CPIN:READY
OK
AT+CREG?
+CREG: 1,1
OK
AT+CGATT?
+CGATT:1
OK
AT+COPS?
+COPS: 0,2,"20205"
AT+CGACT?
+CGACT: 1, 1
AT+HTTPGET="http://www.example.com/"
OK
HTTP/1.1 200 OK
...
So I can't understand if I have have writing something wrong in file rnet or is something else that I am not doing it right. If you have any idea please help me.
The problem was that my A9G Module, was not getting enough power.
Therefore, check if your A9G Module is turned on, before starting the process
and make sure that you have disabled login shell to be accessible over serial,
and also you have enabled the serial interface.

I2C gives I/O- Errors and EEPROM only gives 0x00

I got some troubles with my Pi Zero W (Stretch) and my SparkFun AS7265x Sensor(https://cdn.sparkfun.com/assets/c/2/9/0 ... asheet.pdf):
I connected them over my GPIOs and created an I2C Bus:
I detected my sensor at 0x49 via "i2cdetect -y 1"
I configured my rapsi-config (enable i2c)
I installed the drivers i2c-tools, used the mods i2c-dev and i2c-bcm2708 and edited to my boot/config.txt additionally "dtoverlay=i2c1-bcm2708" and put pi to group i2c for no carrying any longer a sudo with myself.....
--> Now I want to read out some registers e.g. the temperature (0x06) but everything I get is a 0x00 ("i2cget -y 1 0x49 0x06 b")
--> The only register I can read is 0x00 and there I get 0x80 (but default should be 0x40)
so I tried pyserial, but when I want to use: serial.Serial("/dev/i2c-1", 115200) --> I get a cannot configure port error 25
if I write cat /dev/i2c-1 (as explained in some stack overflow topics) I get an I/O-Error.....
I am pretty keyless now.... Maybe there is a clock stretching, but none is mentioned in the data sheet ??
Would be likely if anybody could help me :)
Cheers!
raise SerialException("Could not configure port: {}".format(msg))
serial.serialutil.SerialException: Could not configure port: (25, 'Inappropriate ioctl for device')

OpenOCD multiple STLinks

I need to be connect to 2 STM32s over 2 ST-Links at the same time. I found this issue described here.
However, solution doesn't work for me.
ST-Link ID1: 55FF6B067087534923182367
ST-Link ID2: 49FF6C064983574951291787
OpenOCD cfg file:
source [find interface/stlink-v2.cfg]
hla_serial "55FF6B067087534923182367"
source [find target/stm32f4x.cfg]
# use hardware reset, connect under reset
reset_config srst_only srst_nogate
I get:
$ openocd.exe -f stm32f4_fmboard.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Error: open failed
in procedure 'init'
in procedure 'ocd_bouncer'
I do not know if solved but:
pi#raspberrypi:~/prog/bootloader $ st-info --probe
Found 1 stlink programmers
serial: 363f65064b46323613500643
openocd: "\x36\x3f\x65\x06\x4b\x46\x32\x36\x13\x50\x06\x43"
flash: 0 (pagesize: 0)
sram: 0
chipid: 0x0000
descr: unknown device
this tool shows serial of st-links and there is option called openocd. When I put hla_serial "\x36\x3f\x65\x06\x4b\x46\x32\x36\x13\x50\x06\x43" in file then it works for me. Your way does not. It also does not work in command line given as argument. It works only as I described in cfg file
The format of the configuration file seems to have changed recently. The following applies for Open On-Chip Debugger 0.10.0+dev-00634-gdb070eb8 (2018-12-30-23:05).
Find out the serial number with lsusb, st-link, or with ls -l /dev/serial/by-id. The latter yields (with two STLink/V2.1 connected):
total 0
lrwxrwxrwx 1 root root 13 Nov 30 14:31 usb-STMicroelectronics_STM32_STLink_066CFF323535474B43125623-if02 -> ../../ttyACM0
lrwxrwxrwx 1 root root 13 Dec 30 23:55 usb-STMicroelectronics_STM32_STLink_0672FF485457725187052924-if02 -> ../../ttyACM1
The specification on the .cfg-file is now plain hex. Do not use the C string syntax any longer. For selecting the latter device, simply write:
#hla_serial "066CFF323535474B43125623"
hla_serial "0672FF485457725187052924"

how to record an ir signal from an AC remote using LIRC in raspberry pi?

i had already used the LIRC of the raspberry pi to record and use the IR signals of a samsung TV remote. the recording process was fine. i used this site for reference.But now i am unable to record the IR signals from a bluestar AC in the same method. After 1-3 dots (not always the same number), irrecord exits with the following error message:
irrecord: could not find gap.
irrecord: gap not found, can't continue
then i tried recording the AC remote signals using mode2 and routing it to a text file and manually modified the lircd.conf file to include the raw code as shown in the link
How to use irrecord with 2ms timing instead of the default 5ms?
but then i get the error that
irsend: command failed: SEND_ONCE /etc/lirc/lircd.conf KEY_POWER
irsend: unknown remote : "/etc/lirc/lircd.conf"
Possibly lircd doesn't accept all characters (e.g. slash) for the remote name. Try changing the:
name /etc/lirc/lircd.conf
in the .conf file to a different name (e.g. MY_REMOTE), then invoke the irsend like:
irsend SEND_ONCE MY_REMOTE KEY_POWER
The air conditioning controls send more bits than the television ones for example. You have to configure the lirc.conf header as:
begin remote
name IRAIR1
bits 48 #Configuración para 48 bits
flags SPACE_ENC
eps 30
aeps 100
header 3388 1678
one 430 1257
zero 430 412
ptrail 428
gap 108399
begin raw_codes
name KEY_POWER
3478 1676 500 1218 501 388
472 ..................................
end raw_codes
end remote
I think exactly what 48 bits are sending. This guy explains it: http://absurdlycertain.blogspot.com.es/2013/03/lirc-raspi-remote-control-configuration.html
Do not forget to restart the device, with me it does not work if I do not.
Sorry for my English

“RAM check failed” when using j-Link to erase chip or readback

I closed SWD and JTAG by acident so that I can't download new program into developboard by j-Link.Then I try using j-flash ARM to erase chip, and error comes like this:
Connecting ...
- Connecting via USB to J-Link device 0
- J-Link firmware: V1.20 (J-Link ARM V8 compiled Dec 1 2009 11:42:48)
- JTAG speed: 2000 kHz (Auto)
- Initializing CPU core (Init sequence) ...
- Executing Reset (0, 0 ms)
- Initialized successfully
- JTAG speed: 2000 kHz (Auto)
- Connected successfully
Reading entire flash chip ...
- 64 sectors, 1 range, 0x8000000 - 0x800FFFF
- ERROR: RAM check failed # address 0x20000000.
- ERROR: Write: 0x03020100 07060504
- ERROR: Read: 0xAAAAAAAA AAAAAAAA
- ERROR: (0 bytes of RAM have been checked successfully)
- ERROR: Failed to read back target memory
Disconnecting ...
- Disconnected
I don't know how to use BOOT0 and BOOT1 to get into ISP mode. BOOT0 is connected to GND.
Post some information about your environment.
Are you using IAR EWARM? If you're not, you should download the size-limited trial version. Then, load one of the basic program examples, and try to flash it to your board.
What board are you using? And what do you mean you "closed" SWD and JTAG? I'm not sure what that refers to...jumpers? options window?
Help us out here.