Embedded controller: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (fixups)
Line 8: Line 8:
= Introduction =
= Introduction =


OLPC is now working in an Open implementation of the XOs Embedded Controller.
OLPC is now working in an Open Source implementation of the XO's Embedded Controller firmware.

The code of the EC is programed to a [[Image:KB3700-ds-01.pdf]] that has an 8051 microprocessor, for the code to be open we need to compile everything in [[SDCC]] or [[Open Firmware|OFW]].
The EC hardware consists of the ENE KB3700 ([[Image:KB3700-ds-01.pdf datasheet]]), which has a 8051 microprocessor at it's core. We have chosen to impliment the firmware in C, using [[SDCC]] as our compiler. Efforts are also under way to have CamelForth, a Forth implimentation for the 8051, run on the KB3700.

The need for an open implementation is due to the fact that the actual EC has some flakiness in the recovery process.(among many other things).
The need for an open implementation is due to the fact that the actual EC has some flakiness in the recovery process.(among many other things).
An example of a bug of the old EC can be found in {{ticket|477}}
An example of a bug of the old EC can be found in {{ticket|477}}

Revision as of 22:01, 29 August 2007

  english | español | 한국어 HowTo [ID# 62726]  +/-  
  This page is monitored by the OLPC team.

Introduction

OLPC is now working in an Open Source implementation of the XO's Embedded Controller firmware.

The EC hardware consists of the ENE KB3700 (File:KB3700-ds-01.pdf datasheet), which has a 8051 microprocessor at it's core. We have chosen to impliment the firmware in C, using SDCC as our compiler. Efforts are also under way to have CamelForth, a Forth implimentation for the 8051, run on the KB3700.

The need for an open implementation is due to the fact that the actual EC has some flakiness in the recovery process.(among many other things). An example of a bug of the old EC can be found in #477


Background

The EC is programed in the KB3700 and it has a paramount importance in controlling the XO when the CPU is not active. For doing so the KB3700 has to communicate with the CPU via the EC protocol, this protocol is managed in the ports 0x66 and 0x62 of the KB3700. These two ports are serially connected with the 0x6C and 0x68 ports of the CPU. (for more info check Ec_specification). But the KB3700 has to communicate also with the DS2657 (The battery charger) via the 1 wire Dallas protocol. One can deduce some of the inside programing of the EC via the ec-dump.fth under OpenFirmware. Running the ec-dump script give us valuable data about internals of the ec, mostly the EC_Register_Settings

The procedure to run ec-dump over internet in a wireless connection is:

ok wifi media lab 802.11 *change it to your name AP
ok fl http:\\18.85.2.147\~joel\ec-dump.fth *change to your AP IP direction

Running ec-dump over internet and saving the file in a USB key:

ok wifi media lab 802.11 *change it to your name AP
ok fload http:\\18.85.2.147\~rafael\to-file.fth
ok to-file u:\ec-dump fload http:\\18.85.2.147\~joel\ec-dump.fth

Forth tools

For doing some of the ec work you might need the sdkit tools (sdkit permits that forth runs over linux) and also some other openfirmware code like spiflash.dic

Compiling from the host

first you have to git-clone the open ec code, then inside the openec file make

make -f Makefile.gcc

Skeleton C implementation

  • battery.c Skeleton for battery handling with the Embedded Controller (key)
  • Doxyfile Documentation file
  • fs_entry.c Trampoline for a bankswitching routine
  • Makefile.gcc Makefile per gcc
  • port_0x6c.c host communication routines for the EC of the OLPC
  • states.h Debugging state machine header
  • uart.h Handle serial IO on the EC
  • watchdog.h Handle watchdog of the EC
  • battery.h Skeleton for battery handling with the Embedded Controller (key)
  • ds2756.c Handle Maxim/Dallas DS2756
  • kb3700.h kb3700.h - header file for ENE KB3700 Keyboard Controler
  • matrix_3x3.c Routines to handle 3x3 matrix within the OLPC project
  • port_0x6c.h Host communication routines for the EC of the OLPC
  • timer.c Timer routines for the Embedded Controller of the OLPC project
  • unused_irq.c Safe IRQ stubs for unused IRQ
  • build.c Keeps version related info
  • ds2756.h Handle Maxim/Dallas DS2756
  • main.c Skeleton for the Embedded Controller of the OLPC project
  • matrix_3x3.h Routines to handle 3x3 matrix within the OLPC project
  • sfr_rw.c reading/writing mcs-51 sfr (special function registers)
  • timer.h Timer routines for the Embedded Controler of the OLPC project
  • unused_irq.h safe IRQ stubs for unused IRQ
  • compiler.h SDCC compiler
  • failsafe Failsafe Code.
  • Makefile SDCC Makefile
  • openec.ctl
  • states.c Debugging state machine header
  • uart.c handle serial IO on the EC
  • watchdog.c Watchdog of the EC

Actual development

All the work is going to be in the git repository OpenEC

To get this code in your machine please do:

git-clone git://dev.laptop.org/projects/openec

For info check Importing_your_project

Desired Features

  • Failsafe Code
  • Easy debugging
  • Forth/C implementation.
  • GCC compilable.

To Do

  • Testing

Mail list