Renesas 740 Family Notes

M3800T2-CPE
PD38M compact emulator

PD38M program Compact emulator driver
KD38 User Manual Manual
Firmware Update V1.02 of the firmware for the compact emulator:  Notes / Install
Emulator Adapter 42 pin to 32 pin adapter for DIP connection to target (2mm socket)

FoUSB
Monitor/Programmer for M37544 (740) family MCU

USB driver Win95/2K/XP USB driver installer
In Circuit Programming Overview, applicable devices and target connection examples for using the USB monitor/programmer to In-Circuit program Renesas micro processors.  The current GUI supports both M37542F8 and M37544G2A devices.
Flash Writing App Version 2.10.02 of the flash writing GUI.  Allows Read and write of a variety of devices.
In Circuit Debug App In circuit debug application, (see Compiler Options 2 above).
READ ME! When programming parts using the FoUSB  with the M3A-7536 socket board, YOU MUST CYCLE POWER!.  Bottom line, do not hot insert parts into the programming socket and make sure the FoUSB is set for "Target power" and the 12V/1A adapter is used:

1.     Plug AC adapter into 7536 board (USB will enumerate).
2.     Run FoUSB software, load hex image etc.
3.     unPlug power from 7536 board (USB driver will de-enumerate).
4.     Insert part to be programmed into socket.
5.     Plug AC adapter into 7536 board (USB will enumerate).
6.     Program part.
7.     Repeat steps 3 through 6 every time the part in the socket is changed.

As a sanity check:   A blank part should be all 0xFF from [0xE080 to 0xFFFD] but a part that has not initialized properly may read all 0xFF (And pass) or all 0x00 (And fail).  A real part will only pass from [0xE080 to 0xFFFD] but not from [0xE080 to 0xFFFF].

Programming and Debugging
Quick Start Boards

Uses FoUSB as debug and programming interface

Starter Kit User Manual M3A-7535 quick start debugging board user guide
Starter Kit Schematic M3A-7535 emulator board schematic for M37544 targets (Uses M37594G2 as the emulator)
Low cost programmer M3A-7536 programmer overview
Programmer Schematic M3A-7536 programming interface for M37542/4 devices for use with FoUSB

740 Family Notes

M37544 ROM Although an 8K (8192) byte ROM device, 130 bytes are used by Renesas
R/C Oscillator Graph of Frequency vs Vdd vs R/C for the RC oscillator, with current graphs
Internal Oscillator Graph of Frequency vs Vdd vs Temperature for the internal oscillator

IAR C Compiler Notes

Compiler Options 1 To get an output file with the proper formatting for the final target, use these options in the compiler [Project], [Options] dialogs.
Compiler Options 2 For in circuit debugging using the FoUSB module described below, use these options.  The only changes are in the linker screen 1 and 4 (Output format and Include)
M37544 I/O Header This file defines the I/O mapping of the SFRs into Zero Page RAM
M37544 Interrupt Vector header Reset and interrupt vector definitions

IAR Linker Notes

XLink 4.59 Linker update for all EW-xxx compilers
XLink manual Must read if you plan to edit Linker Control Files (.xcl)
M37544 Linker Control Control file that specifies the memory and other characteristics for the linker, use this one for final target builds
M37594 Linker Control Control file to build an M37544 project for upload into the M3A-7535-ES1 quick start prototyping board

Code Samples

Starter Kit Sample Code Code build that beeps and lights LEDs when buttons are pushed to demonstrate M3A-7535 board
Sample codes Zip file of sample projects for the M37544 MCU
ADC demo project IAR A/D conversion sample project
Buzzer demo project IAR Timer X / Buzzer sample project

Coding Notes

Multi OTP #1 App note:   In this application example, a program with capacity 4KB or below can be written 4 times using QzROM with ROM capacity 16KB. When the revised program is additionally written, the previous program will be disabled and a new written program will be operated.
Multi OTP #2 App note:   In this application example, a program with capacity 4KB or below can be written 3 times using QzROM with ROM capacity 16KB. When the revised program is additionally written, the previous program will be disabled and a new written program will be operated.
Programming Samples 740 Family Sample Programs Collection, application note
C Guidelines Programming Guidelines <C Language>, application note

Cross Compiling Between
IAR740 and PICC

     Bits in IARs EW740 may only be assigned as variables when the root data (Bytes of RAM) have been defined using the SFR data type.   In CCS PICC, INT1 and BIT are the same, and variables defined as bits are built into bytes as encountered.  PICC makes no distinction between SFR bits and variable bits which makes the transition between the compilers difficult.  The following code to test and manipulate bits works because of the SFR preprocessor.  Even though the SFRs are just RAM, the compiler doesn't allow the same treatment of other non-SFR RAM locations.

//IAR SFR definitions from the I/O header file
sfr P0 = 0x00000;    /* Port P0 */
sfr P0D = 0x00001;   /* Port P0 direction register */


//IAR compiler user code then can define these SFR bits as variables
bit scl = P1.0;
bit sda = P1.1;
bit test_port = P1.2;

bit scl_dir = P1D.0;
bit sda_dir = P1D.1;

//IAR then allows manipulation
If (sda)
    test_port = 1;   
Else
    test_port = 0;


In PICC, additional code efficiency can be attained by using bit variables, making use of the bit oriented opcodes.  There is also a memory benefit as 8 bit flags can be packed into each RAM byte.

     Do not use the following CCS PICC language extensions:  Output_Low(), Output_High(), Input_x(), Output_x().  These essentially just map to memory accesses anyway, so define pins as bytes and bits within the SFR ram space and use the standard C functions.  Use a conditional compile to select the current processor and for PICs, be sure to be aware of paging that would have to be managed explicitly.  Below is an example for PICC/EW740 to define and control Port A/Port 0 bit 0:

#define target 0     //0=pic, 1=740

/////////////////////////////////////////////////////////////////////////////////////////
#if target==0  //PICC
//---------------------------------------------------------------------------------------
//use constants to control data/dir registers, note: PIC has opposite dir polarity to 740
#define highz 1           //1=input
#define drive 0           //0=output

//port and direction (tris) register addresses (PIC18F252 addressing from data sheet)
#byte porta    = 0xf80
#byte trisa    = 0xf92

//define bits
#bit scl       = porta.4
#bit sda       = porta.5
#bit scl_dir   = trisa.4
#bit sda_dir   = trisa.5
#byte i2c_port = porta
//---------------------------------------------------------------------------------------
#endif
/////////////////////////////////////////////////////////////////////////////////////////
#if target==1  //IAR EW740
//---------------------------------------------------------------------------------------
//I like to use the PICC intx format!
#define int8 char
#define int1 bit

//use constants to control data/dir registers, note: PIC has opposite dir polarity to 740
#define highz 0           //0=input
#define drive 1           //1=output

//port and direction (tris) register addresses (M37544 addressing done in header file)
int1 scl       = P1.0;
int1 sda       = P1.1;
int1 scl_dir   = P1D.0;
int1 sda_dir   = P1D.1;
#define i2c_port P1
//---------------------------------------------------------------------------------------
#endif
/////////////////////////////////////////////////////////////////////////////////////////
scl=0;                    //set clock/data to 0, control direction from now on
sda=0;
scl_dir=highz;            //set clock/data = inputs (pull up makes this a high)
sda_dir=highz;
.
.
.
while(scl);               //wait for scl to go low
scl_dir=drive;            //make scl an output = low to stretch the clock
if (data && 1)
    sda_dir=highz;        //sda=high
else
    sda_dir=drive;        //sda=low
scl_dir=highz;            //allow scl to go back high
.
.
.

Any questions or comments?
 This page last updated on September 04, 2011