Friday, October 23, 2015

Kriuk Krenyes

Pesan sponsor


Promo bulan oktober beli 3 bungkus kecil hanya 3 ribu tidak berlaku kelipatannya selama persedian masih ada. Syarat & ketentuan berlaku. Harus bawa promo ini atau sebutkan "PROMO OKTOBER" saat membayar. Promo dapat dihentikan sewaktu-waktu tanpa pemberitahuan.
Kami adalah grosir snack atau grosir cemilan dengan merek dagang krenyes (TM). Snack krenyes kami selalu fresh karena perputaran snack kami sangat cepat setiap bulannya.
Silahkan langsung datang ke toko kami di Jalan pajajaran raya perumnas 3 Tangerang.

Keterangan lebih lanjut silahkan buka link  Krenyes

Sunday, January 6, 2013

Getting started on Hercules RM48 USB kit

If you just got RM48 USB Kit, don't forget to download the latest Halcogen from TI Website Ver 3.03.01 as of today. The bundled version on CD  is ver 2.x.
The Halcogen contains example code. Click on Help, Help Topics and Examples. I've been trying the RTI and SCI (UART) example and works. The PWM however doesn't work out of box. It requires you to set hetPORT1 direction.
Here is my example:

/** @file sys_main.c 
*   @brief Application main file
*   @date 15.Aug.2012
*   @version 03.02.00
*
*   This file contains an empty main function,
*   which can be used for the application.
*/

/* (c) Texas Instruments 2009-2012, All rights reserved. */

/* USER CODE BEGIN (0) */
/* USER CODE END */

/* Include Files */

#include "sys_common.h"
#include "system.h"

/* USER CODE BEGIN (1) */
#include "het.h"
#include "gio.h"

/* USER CODE END */

/** @fn void main(void)
*   @brief Application main function
*   @note This function is empty by default.
*
*   This function is called after startup.
*   The user can use this function to implement the application.
*/

/* USER CODE BEGIN (2) */

typedef enum count_direction {
 COUNT_UP = 0,
 COUNT_DOWN
}count_direction;

uint32_t counter = 0;

uint32_t direction = COUNT_UP; //0: up, 1: down

void wait(uint32_t time)
{
 while(time){time--;};
}
/* USER CODE END */

void main(void)
{
/* USER CODE BEGIN (3) */

 hetInit(); //Using HET1, pwm0 at pin HET 0
 gioInit();

 gioSetDirection(hetPORT1, 1);


 direction = COUNT_UP;
 while(1){

   if (counter == 100) {
    direction = COUNT_DOWN;
   } else if (counter == 0){
    direction = COUNT_UP;
   }
   if (direction == COUNT_UP) {
    counter++; //count up
   }else {
    counter--; //count down
   }

   pwmSetDuty(hetRAM1, pwm0, counter );
   wait(20000);
 }
/* USER CODE END */
}

/* USER CODE BEGIN (4) */
/* USER CODE END */



A New Year

It's been a year since my last post. I've been very busy and forget my blog :). Anyway I have new interesting thing to come.

Sunday, January 15, 2012

Testing beagleboard GPIO

Note: Beagleboard C2 use 1.8V for the expansion socket. Do not use higher voltage it may break your processor.

We will use expansion pin 22 (GPIO 157, see Beagleboard reference manual). Connect positive pin of led (long leg) to this port, and then the negative pin led (short leg) to expansion pin 28.
Goto folder /sys/class/gpio/export. There shouldn't be a folder named gpio157.

We need to open the GPIO:
$ echo 157 > /sys/class/gpio/export

Then set the gpio high
$ echo 1 > /sys/class/gpio157/value

or set the gpio low
$ echo 0 > /sys/class/gpio157/value

Finally close the GPIO
$ echo 157 > /sys/class/gpio157/unexport


More reading: http://blog.makezine.com/2009/02/03/blinking-leds-with-the-beagle-board/

Create Minimal Linux 3.2

Create minimal Linux 3.2 with Buildroot 2011.11 for Beagleboard rev C2
1. Get Linux kernel 3.2 from www.kernel.org
2. Get Buildroot 2011.11 from www.buildroot.net
Unpack both package.

Build Buildroot:

$ make menuconfig

1. Target architechture arm, Variant cortex A-8
2. Toolchain Type external arm-none-linux-gnueabi gcc version 4.5.2 (Sourcery G++ Lite 2011.03-41)
3. System Configuration -> /dev management use devtmpfs ( Kernel should also enable DEV_TMPFS=y and DEV_TMPFS_MOUNT=y). This is a must otherwise you may got boot error "can't open /dev/ttyO2: No such file or directory"
4. Change serial port from ttyS2 to ttyO2 (this is for Omap processor)
5. Then select package.

After finish in configuration run:
$ make

Toolchain will be downloaded to output/host/usr/bin You must add this in your PATH before compiling the kernel
$ export PATH=${BUILDROOT}/output/host/usr/bin:$PATH

BUILDROOT: This is your buildroot installation folder.

Build kernel:

$make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi omap2plus_defconfig
$make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi menuconfig
$make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi -j2 uImage
$make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi modules
$make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi modules_install INSTALL_MOD_PATH=/home/user/kernel_dev/buildroot-2011.11/output/target

after that copy your rootfs to your sd card.
$cd /home/user/kernel_dev/buildroot-2011.11/output/target
$rsync -avr * /media/rootfs

Note:
You must change your buildroot folder and your rootfs partition in your sd card.


Note: When configuring kernel don't forget to change ttyS2 to ttyO2.
after running make menuconfig. edit .config and modify DEV_TMPFS and DEV_TMPFS_MOUNT. You have to enable it.

Thursday, January 12, 2012

How to create swap file

Create 1 GB swapfile

dd if=/dev/null of=/swapfile/swapfile.1 bs=1024 count=1048576
mkswap /swapfile/swapfile.1
swapon /swapfile/swapfile.1


To turnoff swap file use


swapoff /swapfile/swapfile.1


Check your memory:
free -m

Use swapon -s to list swapfile in your sytem

You can also add entry in /etc/fstab
/swapfile       none    swap    sw      0       0

and use swapon -a to activate all swapfile


change the /swapfile/swapfile.1 permissions
sudo chmod utgo+rw /swapfile/swapfile.1

Basic NAT with iptables

Assume: eth0 is going to Internet (public), eth1 is going to LAN (internal)

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_froward"


# Masquerade will alter ip address
# /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# Only related and established packet allowed to internal network
# /sbin/iptables -A FORWARD -i eth0 -o eth1 -m state
   --state RELATED,ESTABLISHED -j ACCEPT

# Allow all packet (new connection) from internal to public network
# /sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT




More iptables script from http://ubuntuforums.org/showthread.php?t=1905018





PATH=/usr/sbin:/sbin:/bin:/usr/bin

#
# delete all existing rules.
#
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X

# Always accept loopback traffic
iptables -A INPUT -i lo -j ACCEPT


# Allow established connections, and those not coming from the outside
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i ethwan -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i ethwan -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT

# Allow services
iptables -A INPUT -p tcp --dport 22 -j ACCEPT                #ssh
iptables -A INPUT -p udp -i eth0 --dport 53 -j ACCEPT        #dns
iptables -A INPUT -p udp -i eth1 --dport 53 -j ACCEPT        #dns
iptables -A INPUT -p udp -i eth0 --dport 67 -j ACCEPT        #dhcp
iptables -A INPUT -p udp -i eth1 --dport 67 -j ACCEPT        #dhcp
iptables -A INPUT -p tcp -s 128.173.14.84 --dport 137 -j ACCEPT
iptables -A INPUT -p tcp -s 128.173.14.84 --dport 138 -j ACCEPT
iptables -A INPUT -p tcp -s 128.173.14.84 --dport 139 -j ACCEPT
iptables -A INPUT -p tcp -s 128.173.14.84 --dport 445 -j ACCEPT

# Setup Forwarding between interfaces (all none listed are blocked)
iptables -A FORWARD -i eth0 -o ethwan -j ACCEPT
iptables -A FORWARD -i eth1 -o ethwan -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

# Masquerade.
iptables -t nat -A POSTROUTING -o ethwan -j MASQUERADE

# Don't forward from the outside to the inside.
iptables -A INPUT -j DROP
iptables -A FORWARD -j DROP

# Save the new rules
iptables-save > /etc/iptables.rules