Weston Wayland Tips and Tricks

Here are some Weston Wayland Configuration tricks

To find Video Adapters Identified by Weston

$ ls /sys/class/drm
card0
card0-VGA-1
card1
card1-DVI-I-1
card1-HDMI-A-1
card1-VGA-2

To find supported modes

$ cat /sys/class/drm/card0-LVDS-1/modes 
1366x768
1366x768

Set a resolution

[output]
name=LVDS1
mode=1366x768

To set a custom resolution or with modeline

First issue this command on any system to get modeline of your custom resolution, Here i am using 1920×768@60Hz, you can get modelines for your preffered resolutions using the cvt utility

$ cvt 1920 768 60
# 1920x768 59.86 Hz (CVT) hsync: 47.77 kHz; pclk: 120.00 MHz
Modeline "1920x768_60.00"  120.00  1920 2024 2216 2512  768 771 781 798 -hsync +vsync

Then in weston.ini, the following sets the mode with a modeline,

[output]
name=VGA1
mode=120.00  1920 2024 2216 2512  768 771 781 798 -hsync +vsync

To turn off a Video adapter

[output]
name=VGA1
mode=off
Advertisements

Disabling Linux serial console on Embedded Development Boards

In different boards the systemctl behaved in different manner. For most of the boards to disable linux serial debug console and use it for user purpose use this command

systemctl disable serial-getty@ttyS0.service

systemctl disable getty@ttyS0

In some boards this method didn’t workout an alternate way was to use this command

systemctl mask serial-getty@ttyAMA0.service

To get non root access to serial port add it to dialout group, some systems don’t add debug console to dialout group so edit /etc/inittab and change the permissions.

Happy Hacking πŸ™‚

Obtain Time From GSM netwok using SIM900

Instead of using a Realtime Clock if the Project is already using a SIM 900 module then you can obtain correct Date and Time from the NTP Server GSM Network using the following commands.

AT

OK If your response contains this, This string should tell you all is well

AT+CMGF=1

OK If your response contains this, This string should tell you all is well(Set SMS Text Mode )

AT+CENG=3

OK If your response contains this, This string should tell you all is well(command is used to turn on the engineering mode to get detailed network information)

AT+CCLK?

+CCLK: “16/01/12,07:33:42+00”
If the response is OK then you will get date and time in above format.
Date – YY/MM/DD format

 

SIM 900 Network Time

GPRS using SIM900 and AT Commands

sim900-gprs-gsm-module-arduino-compatible

Powerup the Sim900 module
connect it to the system through serial to USB or through FTDI cable.The TTl pins for FTDI is available near to the DB9 connector.

Open any serial Terminal porogram. In Linux i use GtkTerm. Select the correct port and set
Baudrate = 9600
parity = None
Bits = 8
Stop bits = 1
Flow Control = None

Screenshot from 2015-11-26 12:49:46

 

Screenshot from 2015-11-25 20:00:44

 

The AT Commands

I am posting the commands and its reply for better understanding. I am using an Airtel postpaid sim card.
Make sure you have enough balance on Sim card.

First Command

AT

OK If your response contains this, This string should tell you all is well

This is to check if SIM is unlocked.

AT+CPIN?

+CPIN: READY If your response contains this, then it means SIM is unlocked and ready

This checks if SIM is registered or not

AT+CREG?

+CREG: 0,1 This string in the response indicates SIM is registered

Check if GPRS is attached or not

AT+CGATT?

+CGATT: 1 A response containing this string indicates GPRS is attached

Reset the IP session if any

AT+CIPSHUT

SHUT OK This string in the response represents all IP sessions shutdown.

Check if the IP stack is initialized

AT+CIPSTATUS

STATE: IP INITIAL This string in the response indicates IP stack is initialized

single connection mode,if AT+CIPMUX=1 multi connection mode

AT+CIPMUX=0

OK This string indicates single connection mode set successfully at SIM 900

This sets the PDP context parameters such as PDP type (IP, IPV6, PPP, X.25 etc), APN, data compression, header compression etc.

AT+CGDCONT=1,"IP","airtelgprs.com"

OK If your response contains this, This string should tell you all is well

you need to know the APN, username and password for your service provider
AT+CSTT= β€œAPN”, β€œUNAME”, β€œPWD”
For Airtel

AT+CSTT="airtelgprs.com"

OK If your response contains this, This string should tell you all is well

Bring up the wireless. The response to this might take some time

AT+CIICR

OK indicates wireless is up

Get the local IP address

AT+CIFSR

aa.bb.xx.yy If previous command is successful, you should an IP address in the response

comamnd returns the current connection status

AT+CIPSTATUS

STATE:IP STATUS if not this, some thing is wrong

Start the connection, TCP, domain name, port

AT+CIPSTART= "TCP","flaskprint.herokuapp.com","80"

CONNECT OK This string in the response indicates TCP connection established

Request initiation of data sending

AT+CIPSEND

The response should be the string β€œ>” to indicate, type your data to send
Type anything after the prompt
>This is the Test Data
Now use Ctrl+Z key combination to indicate end of data sending

You should get some response back from the server. Normally some error message. But you have established the connection

To close the connection

AT+CIPSHUT

SHUT OK Indicates shutdown successful

Screenshot from 2015-11-25 20:12:47Screenshot from 2015-11-25 21:53:44Screenshot from 2015-11-25 20:51:29

 

For the ease of Copy Pasting retyping AT commands in sequence

AT
AT+CPIN?
AT+CREG? 
AT+CGATT?
AT+CIPSHUT
AT+CIPSTATUS
AT+CIPMUX=0 
AT+CGDCONT=1,"IP","airtelgprs.com"
AT+CSTT="airtelgprs.com"
AT+CIICR
AT+CIFSR
AT+CIPSTATUS
AT+CIPSTART= "TCP","flaskprint.herokuapp.com","80"
AT+CIPSEND

Happy Hacking πŸ™‚

MICROCHIP PIC MIDRANGE PIC18XX External Interrupt INT1

Configuring the external Interrupt INT1 in PIC18F25k80 is tricky way. The data sheet also may confuse you well.

Screenshot from 2015-06-24 22:53:21

From the pinout pin 22 or RB1 has multiple functions (RB1/AN8/C1INB/P1B/CTDIN/INT1)

These are the things to be noticed while configuring RB1 as external interrupt

Screenshot from 2015-06-24 23:42:47

The RB1 acts also as analog pin to be exact AN8.From the summary of registers associated with PortB we may misunderstand that ANSEL9 is the pin associated with RB1 but that’s wrong. If you look at ANCON1 resister

Screenshot from 2015-06-24 23:48:45

Screenshot from 2015-06-24 23:49:00

This is the most tricky part in configuring external interrupt.The other configurations are pretty straight forward in INTCONbits.

    TRISBbits.TRISB1 = 1;  
    ANCON1bits.ANSEL8 = 0;
    INTCONbits.GIE = 1;
    INTCONbits.PEIE = 1;
    INTCON3bits.INT1IE = 1;
    INTCON2bits.INTEDG1 = 1;
    INTCON3bits.INT1IP = 1;
    INTCON2bits.RBPU = 0;

The above snippet configures INT1 as external interrupt which responds to a rising edge.

Microchip PIC midrange PIC18xx Unable to drive Port C pin 1 as a digital output

Last day i tried to program Microchip PIC midrange controller. To be precise the controller i used was PIC 18F25K80. I was using the C18 compiler. I was unable to drive the PORT C pins as digital, after googling for some time i found out the solution.

Screenshot from 2015-06-24 22:53:21

I tried setting the TRISbits,PORTbits and LATbits but was of no use

 TRISCbits.TRISC1 = 0;/* Port C pin 1 configured for output */
 PORTCbits.RC1 = 1;
 LATCbits.LATC1 = 1;

The answer was that Port C pins 0 and 1 are also used as the input and output to the secondary oscillator.The secondary oscillator had to be set for digital output setting the configuration bits using the #pragma directive

#pragma config SOSCSEL=DIG

By adding this the pin turned digital and blinked

Happy Hacking πŸ™‚

Weekend Hack using python and CANMate

My weekend hack using our company’s(http://www.dthoughts.com) product CANMate (a high performance low cost CAN Analyzer) along with Python programming language.I wrote a python program to use CANMate in GNU/Linux and Windows which is freely vailable.I used Pythons Matplotlib library to plot the real time CAN message from a vehicle’s OBD port.

Happy Hacking πŸ™‚