How to RESET running code on Intel Galileo - linux

I am working on Intel Galileo board(Linux running on board) and using arduino as development environment.
Now on getting a particular gpio pin(say digital pin 6) logic 1, I want to reset my code automatically.
I want reset done by running sketch on its own(i.e. I don't have press RESET button).
I am not using SD card Image.
I am unable to interpret how it should be done.

Just add the following line to reset the sketch, without the inconvenience of a board reboot:
system("./opt/cln/galileo/galileo_sketch_reset_script.sh");

I believe you'll be able to reboot your board by calling in your sketch the system command:
system("reboot");
But there might be a better solution for your main goal. Can you explain a bit more what are you trying to accomplish doing this?

Related

How to solve Raspberry Pi 3B & Bme280 Remote I/O error

Let me start off with the components used:
GPIO extension board to connect the raspberry pi to components
Bme280
Pi 3B
Problem description:
This problem was intermittent at first. We were receiving reading and the error occured out of nowhere, made adjustment to the sensor(taking out and putting it back in) which solved it but when we touch the sensor the error showed up again.
We decided to change the sensor and the problem turned from intermittent to persistent. Now we have this as permanent issue.
We removed the package for BME280 and SmBus2 and decided to reinstall it again.
RPI Bme280: https://pypi.org/project/RPi.bme280/
I followed this BME280 installation guide, however when prompting for 'i2cdetect -y 1' there were lines but no number showing up.
What has been confirmed so far:
Patching up of circuits was fine, tested with my lecturer pi and it
works fine.
Codes is fine, we even use the sample code provided by RPi.bme280
I2c was enabled everytime
Please help me because I am really lost. I needa submit this by next week so any help is appreciated.
Problem pic --> Picture of the problem
I've tried to respond, but there is a few pitfalls in SMBus and i2c, so to break the question into smaller bits I've quoted your original message with an indent. The response is provided beneath.
This problem was intermittent at first. We were receiving reading and the error occurred out of nowhere, made adjustment to the sensor(taking out and putting it back in) which solved it but when we touch the sensor the error showed up again.
I locked onto the statement, "Touched the sensor". Is there a chance the BME280 experienced an ESD discharge? And therefore is now partially or fully broken?
Are you using an ESD safe room? or at least ESD bracelet. You will not notice small ESD discharges, and for small electronics even a sub 1000V discharge can cause damage instantly or over time. (Fundamentals of Electrostatic Discarge - incompliancemag.com)
I followed this BME280 installation guide, however when prompting for 'i2cdetect -y 1' there were lines but no number showing up.
The I2Cdetect -y 1
Will send a ReadBit message to each possible slave 0-127. Then listens for the ACK on the slave address.
The message is very simple, but does the trick for detecting working i2c slaves.
As you stated there is no "Lines", i would suggest the slave either has issues responding, if the BME280 has the correct 3v3+GND supplied.
As another possability, could you redo this step dtparam=i2c_arm=on,i2c_baudrate=400000
(Set the baudrate way down to 10000 /10k. Should this solve the issue and you need higher bandwidth, attempt on "50000 /50k" or "100000 /100k") This is just to eliminate the possibility the slave cannot opperate on this high frequency. 400k Baudrate for SMBus is high for a prototype/testing scenario. Very small amounts of interference can corrupt the data over SDA.
Another possibility is the Sink-Current which i've learned the hard way is not the same on i2c and SMBus over i2c.
Is you Pull-up resistor appropriate for the limited sink-current?
The SMBus specifies a minimum sink current of 100µA, and a maximum of 350µA, compared to 3mA for the I²C bus (Ampere=Voltage/Resistance Ohm).
Now to the Software issue.
From your supplied picture on imgur.
File "newcodes_''''''''''''''.py" line 2, in
Your compiler cannot find "bme" where you attempt to import bme280. Reference/path issue?
This can be the cause for other issues further into the code calls.
I don't know what SW you are writing the code in, but if there is an option to insert a breakpoint and run a debug build. I would suggest starting there :)
Alright I have resolved the issue, I changed the wire from jumper wire to hard wire. Thank you guys for your response. I appreciate all of them :D

Not seeing anything in arduino serial monitor when typing the AT Commands for Bluetooth HC-05

I am a beginner to arduino and trying to follow one of the videos from youtube to make a project- Master And Slave using HC-05 modules. I followed every step from that video carefully. Here's the link to the video ->
https://www.youtube.com/watch?v=BXXAcFOTnBo
For Slave Module when I type AT commands in the serial monitor nothing shows up.
I searched in Internet for the this problem and still didn't fix it. Here's What i have done:
tired restarting my pc
tried Changing arduino, At first i used arduino nano and then uno
I tried changing the baud rate to all other values and nothing happened
And there is no change in light blink, it stays on AT command mode until power is turned off and on again.
This is how is looks
Thank You For the Answer
Your problem is not actually related to arduino in any way. This tutorial is utilizing onboard USB->UART transceiver IC. So in theory you could even remove Atmel chip from the board. Its more like using module like this FT232 converter. Anyways sorry if I confused you but you can research the subject.
But anyways to the problem. Couple of questions:
Did you press reset button on module while powerin up the circuit?
Thats the way it enters to AT command mode
Did you try to reverse RX-TX lines, don't worry connecting these guys across eatch other doesn't harm your board.
(They are so often plugged in wrong..)
Did you make sure you have connected EN pin of module also. (To arduino 3.3V not 5V)
Did you triple check all connections
Try to upload simple Sketch like blinky to Arduino to make sure you are connected to USB-UART transeiver and you have correct drivers.
Make sure you upload empty sketch or remove the chip when you try to apply tutorial steps.
Change jumper wires. Sometimes cheap jumper wires are really bad quality.
I have been sometimes scratching head for long time because of broken jumper cable.
Please let me know if you have checked all of those so we can think for next step.

rfid-rc522 Tag is not read

I am using the instructions of https://pimylifeup.com/raspberry-pi-rfid-rc522/ to learn how to read my rfid-rc522.
I installed all the things needed, and cloned from git all the files. I connected accordingly and double checked the wire.
The code in Write.py is
#!/usr/bin/env python
import RPi.GPIO as GPIO
import SimpleMFRC522
reader = SimpleMFRC522.SimpleMFRC522()
try:
text = raw_input('New data:')
print("Now place your tag to write")
reader.write(text)
print("Written")
finally:
GPIO.cleanup()
When I run it- The result stops after "Now place your tag to write" and nothing happens when I place my tag. Any help please? What's wrong here? The module gives red light meaning it is connected. Is it really connected? How do I know? Please help.
Edit: My title and tags were wrong in this question due to already saved data. I edited. :)
It can be multiple reasons why your reader is not retrieving any data:
The RFID cards that you are providing to the reader are not supported by the ISO 14443: Mifare Classic, 4K. (Some DesFire, etc...) are the cards you want to try. Source: https://en.wikipedia.org/wiki/ISO/IEC_14443
The MFRC522 is not receiving enough input voltage. Try to increase from 3.3V to 4V. I have tried with 5V months and the reader is still running perfectly, but be cautious. The safe range in NXP is from 2.5V to 3.6V. Source: https://www.nxp.com/docs/en/data-sheet/MFRC522.pdf
The library you are using does not support IRQ (Interruption Request). This means the process of reading UIDs is high CPU consuming and low in performance. Try to use this popular library which supports interruptions: https://github.com/ondryaso/pi-rc522 . You will need to connect another wire from the IRQ pin in the MFRC522 to one GPIO pin in the Raspberry that is free and supports reading/writing operations.
Check if SPI interfaces are enable in Raspbian. Open a terminal and run:
ls -l /dev/spi
Lastly, it could be that your reader is broken. Some chinese versions do not work as they should do. Maybe you should buy another one and try more luck.
I suppose you have connected all cables in the correct way between the MFRC522 and the Raspberry Pi. Check that again.

Banana Pi not booting (red LED on)

I got some brand new banana Pi's,
these are the "Banana Pi-M2" and the "Banana Pi-M3"
I was trying to install Debian on both of them, but I couldn't get it to work.
I was exactly following this tutorial here (Windows):
http://wiki.lemaker.org/BananaPro/Pi:SD_card_installation
to save Debian on the SD Card.
The Problem is always the same. When pressing the power Button on the "M3", or plugging in the "M2", only the red LED goes on and nothing happens.
The LED for the LAN port stays off, so it comes close that the Pi is not booting up.
The power supply I am using produces 5V and 2100mA which should fit the conditions for the Banana Pi.
The distros I then tried to install were for example Bananian which I got from here:
https://www.bananian.org/download
And several distros like Debian from here:
http://www.banana-pi.org/m3-download.html
http://www.banana-pi.org/m2-download.html
I tested it using 2 different SD Cards, and also only using a USB Stick.
everything was producing the same error.
Is there something I missed?
Thanks in advance.
It sounds like an underpowering situation.
If you have a barrel jack instead of micro usb use the barrel jack.
The pre-production samples of this board had the usual 4.0/1.7mm barrel jack for DC-IN BPi M2/M2+ also use. This has been replaced by a Micro USB jack on the first production batch in Dec 2015 leading to the usual sorts of problems banana-pi.org forums are full of (see also next paragraph for some reasons). Starting in May 2016 Micro USB has been replaced by the 4.0/1.7mm barrel jack again so powering is possible more reliable now. The Micro USB receptacle on the longer board side is USB OTG, also connected to the board's PMIC and while looking like an alternative way to power the board that's not recommended unless you love underpowering situations, reboot loops and the like.
I had the same problems at one point, like #Hagen said, it could be under powered, make sure you have a 5V, 2A rated power supply. The other cause of the red led and no boot is the lack of a micro SD card. Try pushing it in a bit further though not with much force and hit reboot. if you get 3 leds, it works!
This Banana PI M3 device starts up and works normally when power supply connector (4mm/1,7mm) and a micro USB connect put to device of Banana same time from same 5V power supply. I think in the device may have something grounding problems.

Detect Lid Rotation - Lenovo Thinkpad Yoga 15

I just picked up the Lenovo Thinkpad Yoga 15 (20DQ001KUS) for $799. Here is a link: http://shop.lenovo.com/us/en/laptops/thinkpad/yoga-series/yoga-15/#tab-tech_specs
I'd really like to get the tablet features working in Linux Mint 17.2. I have been doing some googling and found some old scripts below:
https://github.com/admiralakber/thinkpad-yoga-scripts
https://launchpad.net/magick-rotation
With their help, I was able to put together a python script that polls my accelerometer values (found in /sys/bus/iio/devices/iio:device*) to figure out when the screen should be rotated. The difficult part seems to be detecting when the device should be in laptop or tablet mode. If I bend the lid past 180 degrees, or if I tilt the device on its side so that it is perpendicular to the ground, there is a light on my keyboard that shuts off and the keyboard itself is completely disabled. This appears to be a bios feature and indicates that there is definitely a sensor. This would be ideal, and it would solve all of my current problems.
Unfortunately, I have been unable to find any sensor readout in linux that would tell me when the computer should be in tablet mode. I need this to determine when autorotate should be turned on, when the touchpad/trackpad/keyboard should be disabled, and when I should launch or kill the onscreen keyboard app.
In the meantime, I'm using the lid's incline sensor (also found in /sys/bus/iio/devices/iio:device*). This works mostly, as It can detect tent mode and tablet mode. Unfortunately, the sensor is aligned to gravity, so it cannot tell the difference between laptop mode and stand mode (because the lid/screen is in the same orientation with respect to gravity).
The older scripts suggest that there is a special keycode in older models that is triggered when the mode changes from laptop to tablet and vice-versa. Unfortunately, I am not seeing any such keycode/scancode being thrown when I monitor xev/evtest.
In short, I'd like to be able to programmatically determine when the laptop screen/lid is opened more than 180 degrees. Can anyone help me with this?
My current script is linked below, if anyone else wants to see how I'm doing it (or if anyone else wants to make suggestions), I've only spent a day on it, so it's nowhere near finished. I'll probably publish it for GNU release at some later point in time for anyone else needing the same functionality.
https://gist.github.com/anonymous/5d2c2d2967eac8774b69
P.S. As an aside, I'm still trying to get full functionality from the ALPS touchpad. Using some psmouse DKMS installers, I have been able to get multi-touch capabilities like two-finger scroll and two/three finger tap working. However, the 3 physical buttons don't do anything (even in xev/evtest). Passing proto=imps to the psmouse module causes them to work , but breaks multi-touch functionality. If anyone would like to offer advice for that, I'd be grateful as well.

Resources