Serial Port

See the function OPEN-SER in term.lisp then look for the value of the variable *serial-device* If your serial port is not "/dev/ttyS0" or "/dev/ttyS1" or whatever *serial-device* is currently set to, then you must edit the value of that variable to refer to the correct name for your serial port. "/dev/ttyS0" is the first serial port under Linux. The same port would be named "COM1" under Windows.

Each time I boot to Linux, I run minicom and let it configure the serial port for me. If you do the same, and save your settings, in the future you can configure the serial port just by starting minicom and immediately exiting. When you exit, it asks if you want to "Leave without reset?" — say yes. At the least, set the baud rate so it matches your target ARM chip's baud rate. I use 115200 bps. I turn off both hardware flow control and software flow control).

Beware of the DTR and RTS lines on your serial port. If they are connected to your target ARM chip (perhaps to its bootloader pin and reset pin), you might have trouble. It might be better not to connect those lines to your target ARM chip but instead just control the bootloader and reset pins manually. On my Olimex lpc2106 board, there is a jumper (a shorting block) that I connect to put it in bootloader mode (it grounds port 0 pin 14) or disconnect to put in normal mode (port 0 pin 14 is pulled high by a resistor). There is a push button to reset the chip.

My Olimex board has a Philips lpc2106 ARM chip with a 14.7456 MHz crystal. I do not turn on the PLL, thus the CCLK (i.e. the CPU clock) is the same as the crystal, 14.7456 MHz. I leave the peripheral bus running at its default speed of one quarter the CCLK speed. Thus PCLK (the peripheral clock) is running at 3.6864 MHz. The primitives file (riscy.asm) or its included file (custom-lpc2106.asm) sets the serial port divisor based on this to give a baud rate of 115200 bps. If your crystal, etc. are different, you must edit riscy.asm (or the include file for your CPU such as custom-lpc23xx.asm or custom-lpc2106.asm) and/or configure you PC's serial port accordingly.

If you think you have programmed the combined primitives and high-level Forth image into the target ARM chip, but nothing seems to work right when you run the interpreter, here are some things to try: