Getting userinput in STM32F4Discovery using ChibiOS RTOS

To get user input in STM32F4Discovery..chnage directory to the concerned folder

cd ChibiOS_2.4.1/demos/ARMCM4-STM32F407-DISCOVERY/

edit the main.c file and insert this code

#include "ch.h"
#include "hal.h"

int main(void) {

halInit();
chSysInit();

palSetPadMode(GPIOD,4, PAL_MODE_INPUT);
palSetPadMode(GPIOD,6, PAL_MODE_OUTPUT_PUSHPULL);

while (TRUE) {
int x;
x=palReadPad(GPIOD,4);
if (x){
palSetPad(GPIOD, 6);
}
else{
palClearPad(GPIOD, 6);
}

}
}

Here GPIOD pin4 is set as input and pin6 is set as output….I connected a button to 5v and the out of the button is connected to  pin4 which is set as input whenever i press the button pin4 becomes high and whenever pin4 becomes high pin6 becomes high an led is connected to pin6 to know the user button action…

to generate binary

cd ChibiOS_2.4.1/demos/ARMCM4-STM32F407-DISCOVERY/

make

st-flash write build/ch.bin 0x08000000

Happy Hacking 🙂

Advertisements

STM32F4Discovery GPIO Programming using ChibiOS RTOS

To use the gpio pins…

cd ChibiOS_2.4.1/demos/ARMCM4-STM32F407-DISCOVERY/

Similar to the earlier method edit the main.c file and insert this code

#include "ch.h"
#include "hal.h"
int main(void) {
halInit();
chSysInit();
palSetPadMode(GPIOD, 4, PAL_MODE_OUTPUT_PUSHPULL); /* PD4 */
while (TRUE) {
palSetPad(GPIOD, 4);
chThdSleepMilliseconds(500);
palClearPad(GPIOD, 4);
chThdSleepMilliseconds(500);
}
}

The palSetPadMode configures PD4 or GPIOD’s fourth pin as output..now connect an led to the PD4 and see output

Now repeat the older steps to generate binary

cd ChibiOS_2.4.1/demos/ARMCM4-STM32F407-DISCOVERY/

make

st-flash write build/ch.bin 0x08000000

Happy Hacking 🙂

Getting started with STM32F4Discovery and ChibiOS

ChibiOS is a portable,open source RTOS…ChibiOS can be downloaded from source forge

http://sourceforge.net/projects/chibios/

Extract the downloaded file..Inside the folder you can see a folder named Demos inside that our board will be listed ARMCM4-STM32F407-DISCOVERY inside that folder there will be a main.c….Edit that main.c file

#include "ch.h"
#include "hal.h"

int main(void) {

halInit();
chSysInit();

palSetPadMode(GPIOD, GPIOD_LED4, PAL_MODE_OUTPUT_PUSHPULL); /* Green. */

while (TRUE) {
palSetPad(GPIOD, GPIOD_LED4);
chThdSleepMilliseconds(500);
palClearPad(GPIOD, GPIOD_LED4);
chThdSleepMilliseconds(500);
}
}

palSetPadMode configure the I/O as input or output….palSetPad and  palClearPad is similar to High and Low…halinit is the intialization of hardware abstraction layer and chsysinit is the intialization of kernel…

Open a terminal and change directory to that folder

cd ChibiOS_2.4.1/demos/ARMCM4-STM32F407-DISCOVERY/

make

st-flash write build/ch.bin 0x08000000

Happy Hacking 🙂

Howto Configure Thin client in ubuntu 10.04 and 12.04

Recently i got a thinclient…This is how i configured it in ubuntu….

I tried the steps in both ubuntu 10.04 and 12.04 and it worked fine..

The hardware of the thinclient couldnt support 12.04’s unity desktop so it switched back to gnome classic..

First we need to install some packages in our system

sudo apt-get install autoconf build-essential libpam0g-dev 
sudo apt-get install libssl-dev tightvncserver

Now download xrdp an opensource RDP software and x server capable.Either you can download it from xrdps sourceforge site or from spectras site the latest one is from source forge

http://www.spectraindia.com/software/xrdp/

http://sourceforge.net/projects/xrdp/

I downloaded the latest xrdp-v0.6.0.tar.gz 

uncompress it

tar -zxvf xrdp-v0.6.0.tar.gz
cd  xrdp
./bootstrap
./configure
make
sudo make install

Now xrdp installation is complete now to start xrdp

whereis xrdp
sudo /etc/xrdp/xrdp.sh start

If everything goes fine xrdp daemon will start correctly…Now connect a monitor,keyboard and mouse to the thin client…connect it to the network….When you turn on the thin client this will be the first screen that you get…The firmware of the thin client i got was windows and i didnt find a bios option too..

From the screen select Connect Host

 

 

 

 

 

 

 

 

 

 

Click on Add

 

 

 

 

 

 

 

 

 

Then it will prompt for password the default password is 123.Enter it

 

 

 

 

 

 

 

 

 

Enter the host ip and click on connect…It will boot into a login screen

 

 

 

 

 

 

 

 

 

Give username and password of host system

 

 

 

 

 

 

 

 

 

——————–

 

 

 

 

 

 

 

 

 

Now it will boot into the host system and we can use the desktop

 

 

 

 

 

 

 

 

 

Happy Hacking 🙂