Archive for February, 2008

MSI S270 Laptop problems

Monday, February 25th, 2008

I own a MSI S270 laptop since two and a half years. Recently it’s getting more and more problems.

The problems listed:

  • Cable break in cable to laptop screen, screen will turn on/off in different angles
  • Keyboard has some ‘sticky’ keys (control and alt key)
  • Laptop is switching from battery to AC and back when it is connected to the adapter (only when stressing the laptop

Today i opened my laptop and tried to fix the problems. Luckily this is not the first time i opened my laptop so i already got the hang of it. The cable of the laptop screen isn’t easy to repair and i also don’t know which wire because there are many. I think it is the wire supplying the power to the screen because the whole screen turns off. I cleaned the keyboard a bit although it wasn’t very dirty. I hope this will fix the keyboard problem. For the last problem i don’t have an idea where to look.

MSI S270 opened (2)

The laptop opened

MSI S270 cable break

The cable break is at the red ellipse. It is the cable with the colored isolation

MSI S270 opened

The laptop opened

MSI S270 keyboard

The keyboard

Function key inverted

Monday, February 18th, 2008

When the function key of my laptop keyboard is working inverted: check if the NUMLOCK is on! ;-) (Took me a few days to figure this out…)

Blackfin BF533: Core and System clock

Tuesday, February 5th, 2008
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void init_PLL(void)
{
	short tmp;
 
	*pSIC_IWR=0x01; // only PLL wakeup
	ssync();
 
	*pPLL_DIV = 0x001B; //cclk=vco/1;sclk=vco/11
	ssync();
 
	tmp = cli();
 
	*pPLL_CTL=(12<<9); //vco=12*clkin, clkin=27M
	ssync();
 
	idle();
	sti(tmp);
}

Blackfin BF533: Programmable flags with interrupts example

Tuesday, February 5th, 2008
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
	This example shows how to use 
	interrupts with programmable flags.
	PF8 will be used. When PF8 goes from low to high
	there will be an interrupt.	
*/
 
#include<stdio.h>
#include<cdefbf533.h>
#include<sys\exception.h> // needed for interrupts
 
// prototype
EX_INTERRUPT_HANDLER(FlagA_ISR);
 
void main(void)
{
 
	// Register FlagA ISR to interrupt vector group 12
	register_handler(ik_ivg12, FlagA_ISR);
 
	// set direction of programmable flag PF8 to input
	*pFIO_DIR &= ~PF8;
	ssync();
 
	// interrupt enable PF8
	*pFIO_INEN |= PF8;
	ssync();	
 
	// give interrupt when FIO_FLAG_D PF8 changes
	*pFIO_MASKA_D |= PF8;
	ssync();
 
 
	// Bind FlagA interrupt to IVG12
	*pSIC_IAR2 |= 0x00005000; // flag A IVG12
	ssync();
 
 
	// Enable PFA in system interrupt mask register
	*pSIC_IMASK = 0x00080000;
	ssync();
 
	// enable IVG12 in core interrupt mask register
	*pIMASK |= 0x00001000;
	ssync();
 
	// wait for interrupt
	while(1);
}
 
EX_INTERRUPT_HANDLER(FlagA_ISR)
{	
	printf("\n interrupt received!");
	fflush(stdout);
 
	// or do something else...
}

Blackfin BF533: Programmable Flags example

Tuesday, February 5th, 2008

There are 5 important registers for the Programmable Flags:

FIO_DIR: I/O direction
FIO_FLAG_D: Direct access to data of the programmable flags
FIO_FLAG_S: Write 1 to set flags
FIO_FLAG_C: Write 1 to clear flags
FIO_FLAG_T: Write 1 to toggle flags

With the last three registers it is not needed anymore use bitwise functions for setting, clearing and toggling flags :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
	This example shows how to use programmable flags of the BF533.
	The BF533 has 16 programmable flags (GPIO).
	This program toggles all flags.	
*/
 
#include <cdefBF533.h>
 
int main(void)
{
 
	int delay;
 
	// set direction of all flags to output
	*pFIO_DIR = 0xFFFF;
	ssync();
 
	// directly access data register
	// set all flags to high
	*pFIO_FLAG_D = 0xFFFF;
	ssync();	
 
	while (1) {
 
		// set all flags to high
		*pFIO_FLAG_S = 0xFFFF;
		ssync();
 
		for (delay = 0x00FFFFFF; delay>0; delay--); 
 
		// clear all flags (set to low)
		*pFIO_FLAG_C = 0xFFFF;
		ssync();
 
		for (delay = 0x00FFFFFF; delay>0; delay--);
 
		// FIO_FLAG_T register can also be used to toggle here!		
	}	
 
	// never reached
	//return 0;
}

Blackfin BF533: ADSP-BF533 EZKIT LITE LED’s example

Tuesday, February 5th, 2008
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
	This example shows how to use the 6 LED's 
	on the ADSP-BF533 EZ-KIT LITE.
	The LED's are connected on the Flash A chip instead of GPIO.
	This program will toggle the LED's
*/
 
 
#include <cdefBF533.h>
#include <stdio.h>
 
// addresses in Flash for the LED's
#define pFlashA_PortB_Dir	(volatile unsigned char *)0x20270007
#define pFlashA_PortB_Data	(volatile unsigned char *)0x20270005
 
int main(void)
{
 
	printf("Showing how the leds work on the BF533 EZ-KIT Lite");
	fflush(stdout);
 
	// External Bus Interface Unit setup, for access to flash A
	// It is not important to understand this
	*pEBIU_AMBCTL0	= 0x7bb07bb0;
	*pEBIU_AMBCTL1	= 0x7bb07bb0;
	*pEBIU_AMGCTL	= 0x000f;
 
	// flash data direction, b 111111
	*pFlashA_PortB_Dir = 0x3f;
 
	unsigned int delay = 0;
 
	while (1) {
 
		*pFlashA_PortB_Data = 0x15;	// b 010101
		ssync();
 
		// wait some time
		for (delay = 0x00FFFFFF; delay > 0; delay--);
 
		*pFlashA_PortB_Data = 0x2A;	// b 101010	
		ssync();
 
		// wait some time
		for (delay = 0x00FFFFFF; delay > 0; delay--);
	}
 
 
	// never reached
	//return 0;
 
}

Compiled with VisualDSP++ 5.0

Circular buffer queue in C

Tuesday, February 5th, 2008
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* CIRCULAR BUFFER QUEUE */
 
#include <stdio.h>
 
#define BUFFER_SIZE 8
 
int data_size = 0;      // number of chars in buffer
int read_pointer = 0;   // indice number of last read char
int write_pointer = 0;  // indice number of last written char
int input;              // user input 
char add;               // char to add
 
char buffer[BUFFER_SIZE];
 
// prototypes
int buffer_full(void);
int buffer_empty(void);
void push_char(char c);
void pull_char(void);
 
int main(void)
{
 
  int i; 
 
  printf("Circular Buffer Queue Implementation");  
 
  // make sure there are no random chars in array, all spaces
  for (i = 0; i < BUFFER_SIZE; i++) buffer[i] = 0x20;
 
  while (input != 4) {
 
    printf("\n    press 1 to push char");
    printf("\n    press 2 to pop char");
    printf("\n    press 3 to show queue");
    printf("\n    press 4 to exit\n");
    scanf("%d", &input);
 
    // push char
    if (input == 1) {
 
      printf("\nEnter char: ");
      scanf("%c", &add);
      scanf("%c", &add); // twice otherwise it will get the last enter as input
 
      if (! buffer_full())
        push_char(add);
      else
        printf("\nBUFFER IS FULL!");      
 
    }
    // pull char
    else if (input == 2) {
 
      if (! buffer_empty())
        pull_char();
      else
        printf("\nBUFFER IS EMPTY!");      
    }
    // display buffer info
    else if (input == 3) {
 
      printf("\n data_size: %d read_pointer: %d write_counter: %d", 
      data_size, read_pointer, write_pointer);
 
      printf("\nQueue content:\n");
      for (i = 0; i < BUFFER_SIZE; i++) printf("[%c]", buffer[i]);
 
    }
 
    printf("\n----");       
  } 
 
  return 0;
}
 
// adds a char
void push_char(char c)
{
    // increase write_pointer, check if at end of array
    if (++write_pointer >= BUFFER_SIZE) write_pointer = 0;
 
    buffer[write_pointer] = c;    
    data_size++;
}
 
// returns 1 if buffer is full, 0 if buffer is not full
int buffer_full(void) 
{
	return read_pointer == write_pointer &&
	 		data_size == BUFFER_SIZE;
}
// returns 1 if buffer is empty, 0 if buffer is not empty
int buffer_empty(void)
{
	return read_pointer == write_pointer && 
			data_size == 0;
}
 
// pull char from queue
void pull_char(void) 
{  
  if (++read_pointer >= BUFFER_SIZE) read_pointer = 0;
 
  printf("\nPopped char %c", buffer[read_pointer]);
 
  // enter space on place of read char so we can see it is removed
  buffer[read_pointer] = 0x20; 
  data_size--;  
}

How to pronounce Eee PC

Saturday, February 2nd, 2008

I used to pronounce Eee PC as “ieh ieh ieh piesie”. This is rather uncomfortable.

Check this movie to know how to pronounce Eee PC and also Asus ;) http://gizmodo.com/gadgets/eee-pc/how-to-pronounce-eee-pc-320007.php