Saturday 18 September 2010

Getting the voltages right


One of the problems with the serial port is that it is rather high voltage - up to 15v. The STM operates at 3.3v - so we cannot directly connect it. To make this work properly we use a MAX3232 IC, which converts from one level to another - allowing us to talk to the STM32 board.

For this section, you will need 5 x 0.1uf capacitors (I used polyester ones which are cheap) and a MAX3232 IC (which is a couple of dollars).

On the breadboard :

1) Plug in the IC in a sensible spot, notch up.
2) Connect 3v3 to pin 16 and GND to pin 15. (these pins are on the top left of the STM board)
3) Put capacitors across - pins 1 and 3, pins 4 and 5, pins 6 and 15, pins 16 and 15, and pins 2 and 16.
4) Connect the cable you made in the last step so that :-
- RxD (pin 2 on the socket) is connected to pin 14
- TxD (pin 3 on the socket) is connected to pin 13
- GND (pin 5 on the socket) is connected to pin 15

Now put the short back in between pins 12 and 11 - this is the 'loopback' test again.
The completed serial interface, with the "loopback" short in place.

If you do this and it is working, as before the characters should echo back as you type them in to GTKTerm or whatever terminal program you use - you have connected the in and out together again, but at "the other side" of the chip where the voltages are okay for the STM32.

Now take the loop-back out. Here is the circuit. (Apologies for the text positioning, there are some bugs here)
Serial Interface Circuit



The next time we will start talking to the Microcontroller.

7 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Just as a tip, the Dallas DS275 does the same job without the capacitors: http://www.maxim-ic.com/datasheet/index.mvp/id/2929

    (example circuit: http://foo.joose.biz/ds275.png )

    ReplyDelete
  3. Hi,
    Paul thank you for your great tutorials!
    I saw that you are using 3.3V for max232 voltage, is it working like this?

    ReplyDelete
  4. Sorry, now I saw that you are using max3232

    ReplyDelete
  5. There is an error on circuit schematic - on the left-hand side, pin 3 of "STM32 MCU" header probably should be connected with IC1 pin 12 (RDO) instead of with IC1 pin 10 (RTSI), if it is meant to act as simple level translator 3.3v asynchronous serial communications port <-> RS232

    ReplyDelete
  6. Hi, thank you for your tutorial
    but I still fail, I think it because of configuration of CN2 and CN3 connector
    I still confuse what we need to do to CN2 and CN3 connector to make the processor work in system memory mode

    ReplyDelete
  7. The trainers employed by STC Technologies company are certified professionals who have years of experience in the field of software testing. High tech classrooms and labs ensure that students stay ahead in the market. STC Technologies

    ReplyDelete