########################################################################
Tipps Tricks and Pitfalls
Device: C868-1Sx
BA-step
Date:
LastChng:
Author: Andreas
Jansen, AI MC IGM
(C) Infineon Technologies AG
########################################################################
************************************************************************
C868 web-page
http://www.infineon.com/cgi/ecrm.dll/ecrm/scripts/prod_ov.jsp?oid=30553&cat_oid=-8136
************************************************************************
************************************************************************
(1)UART - stop T2 in users code when reconfiguring UART
When booting the device from UART the
onchip bootloader routine
configures the UART with T2 as baudrate generator.
Therefore T2 runs and the serial interface is configured when leaving the bootmode.
If the user's program configures the
UART differently (e.g. other mode or T1 as baudrate
generator) it has to be ensured that T2
is stopped before changes become valid.
Ensure that the routines generated by
DAvE are called in the proper sequence. Please have a
look into example b11_ee_isys.zip
Proper sequence is:
/// Initialization of module 'Fail Save
Mechanisms'
FSM_vInit();
/// Initialization of module 'Timer 2'
T2_vInit();
/// Initialization of module 'Timer 0/1'
T01_vInit();
/// Initialization of module 'Serial
Interface (UART)'
UART_vInit();
************************************************************************
************************************************************************
(2) WDT - restarting WDT is not
possible
Once the WDT is stopped by software
it cannot be restarted. In all C868 AB-step and C868 BA-step till datecode E244 the WDT is stopped in the Bootstrap Loader
routines. The actual datecodes do not stop the WDT, therefore the user has to refresh the WDT accordingly.
************************************************************************
************************************************************************
(3) SWAPPING - code execution from XRAM
With the C868's memory concept one
can switch between the chipmodes. With this the XRAM
can be configured as code memory and the SRAM as data memory. This might be
useful for debugging purpose, programming EEPROM by copying SRAM contents etc.
An example code is given below:
CSEG at 0000h ;
SRAM
Start:
;
some user code here
;*
now swap and jump to XRAM
Swap2XRAM:
mov syscon1, #81h ;set ESWC,
set SWAP, clr BSLEN
orl syscon1, #40h ;set SWC
ljmp 0ff00h ;jump to
address ff00h in xram
;*
this is the address where XRAM-routine jumps back
Sback: ljmp Sback
CSEG at 0FF00h; XRAM
Xstart:
;
some user code here
;*
now swap and jump back to SRAM
Swap2SRAM:
mov syscon1, #80h ;set ESWC, clr SWAP, clr BSLEN
orl syscon1, #40h ;set SWC
ljmp Sback ;jump
to SRAM label Sback
sjmp $ ;never
come here
************************************************************************
************************************************************************
(4) Problems with SK868 - Optocoupled
UART interface
Sometimes proplems
occur when PC wants to connect or download code to the SRAM using e.g. MiniDebugger together with the optocoupled
UART interface on the SK868. The reason for this is that PCs have different
voltage levels at the RS232 interface. This makes trouble with the right
current for the optocoupler's transmitting/receiving
diode.
There are 2 solutions:
1) resolder and replace 3 resistors and introduce one capacitor
(Option 1)
2) bridging
the OC by soldering option (unsolder one resistor, put in two wires), loosing
the isolation ofcourse (Option 2)
Detailed explanation of the problem:
The optocoupler
is used as a very low cost and isolated interface for high voltage
applications, ie. directly
connect the C868 signals to a hot powerstage of a
motor and communicate wiht a host PC. The advantage
is:
- no need of
a separated supply cause the OC is supplied by the PC (DTR-signal)
- this
overcomes the 3.3 to 5V problem for most of the MAX232 devices
The disadvanteges
are:
- it is not
compatible to RS232 standard (+12V/-12V >> +12V/0V)
- it is
limited in baudrate due to the slow OC (max 9600)
- the
circuit depends on the PC-voltages
The latter one is supposed to be the rootcause. Some PCs have +12V others only +7V.
The optocoupler
has a saturation time and this depends on the current which flows through the
transmitting diode. The more current, the longer the
saturation but also the less current the slower the OC. For
synchronization to the host there is an autobaudrate
detection routine in the bootrom. This routine is
waiting on 80h from PC and calculates the baudrate -
here the saturation time of the OC is important. For datatransmission
it is more or less the rise/fall time of the optocoupler
(speed) which is important. Therefore we have to optimize the current due to the
right dimensioning of resistors.
For some real lousy PCs we have to
introduce a buffer capacitor on the DTR-line (see OPTION 1). Adaption of resistors R31/R49 at OC U7 also helps a lot.

************************************************************************
************************************************************************
(5) EEPROM is contains
password but contains wrong code
Once the EEPROM contains the password A5h
the C868 will boot from the EEPROM and not from UART. Rechanging
this is possible in two ways:
-
Actively reprogramming the A5h. This
requires that there is code inside the users
application which takes care for this. Please refer to Application Hint “InSystProgC868V20.pdf”
on the C868 web page.
-
Shortcutting the pins 1 and 2 from the
SPI-EERPOM (CS/SO) while booting. This means take a screwdriver (!) or anything
else which is electrical conducting and put it between Pin 1-2 while pressing
reset. After releasing reset the C868 will not receive A5h and will start its
UART-bootmode. Then you can connect with minidebugger and reprogram the EEPROM.
************************************************************************