2012-02-08 11:49 AM
I have an application that needs 9 (yes, 9) serial ports. The STM32F103 I am using supports 5, so I am adding an external 16554 quad uart. As part of my testing before actually getting a board built, I am trying to interface a single 16550 UART to my STM3210_EVAL board.
To interface, I am trying to use the FSMC and connecting the UART as if it were SRAM. I am using Bank 1, and have removed R22 to disconnect the NAND flash that normally uses PD7/FSMC_NE1. When I write to the device, I can verify using my oscilloscope that the address, data, OE (FSMC_NOE), WE (FSMC_NWE) and CS (FSMC_NE1) lines are all going to the proper states. I see the address lines set up, the data lines set up, the CS fall then the WR strobe properly, and it looks like all the timings are within spec (I'm running at 72Mhz, but have set all the RAM timings to the slowest possible). My problem is this. When I try to read from the device, the UART doesn't ever seem to drive the bus with data. I started out trying to write to the scratch register at address 0x07 (0x60000007 in CPU space), then read it back. At first, I thought this was working, in that if I created a loop and wrote 0 to 255 and read each back immediately after writing, I would read what I wrote. But, reading other registers gave me nonsense values. I discovered that if I wrote to the scratch register then delayed 2ms before reading, I would read back 0x00 instead of what I wrote. Checking with the scope, I verified that the data was placed on the bus with the write strobe, and at the end of the write strobe when all of the data lines were again tri-stated, the data lines began sagging towards zero, which takes about 1.5ms. If I read immediately after write, the data was still there, but if I delayed, it had decayed back to zero. My question is, has anyone else tried to interface a 16550 UART to the FSMC on an STM32 processor? If so, what were your experiences, and do you have any advice on how I can resolve my problem? Or, barring that, has anyone else used a different quad UART with and STM32? I was avoiding SPI uarts because of the overhead, but if there is a known good interface and maybe sample code, that might sway me towards using one of those. Thanks in advance for any help, Jeff.