cancel
Showing results for 
Search instead for 
Did you mean: 

Can this be done with a STM32F103ZE

dubedat68
Associate II
Posted on March 16, 2015 at 13:17

Hello,

I have no experience at all with micro controllers & only brief experience with wiring up electronics / & some low-level programming, so please accept my apologies up-front.

I have a need to create a device that:

     a.  Has ONE (1) incoming RS232 port

     b.  Has FOUR (4) separate outgoing RS232 ports

     c.  ''reads'' an incoming RS232 stream,

     d.  look at the first 2 Bytes of info

     e.  check for the ''address'' (2nd byte)

      f.  if it is addressed ''FF 01 .........'', forward the complete original data out PORT 1 ONLY

     g.  if it is addressed ''FF 02 .........'' re-address the data to ''FF 01 ........'' and forward the complete data out PORT 2 ONLY

     h.  if it is addressed ''FF 03 .........'' 

re-address the data to ''FF 01 ........'' and forward the complete data out PORT 3 ONLY

      i.  if it is addressed ''FF 04 .........'' 

re-address the data to ''FF 01 ........'' and forward the complete data out PORT 4 ONLY

Here is a drawing of this for those who are more ''visual'' like me.

https://communities.intel.com/servlet/JiveServlet/showImage/2-284311-243094/PelcoD---prototype.jpg

The baud rate is 9600, 8, N, 1 (no flow control), if that helps.

Is this possible with the STM32F103ZE?

If so, would anyone be willing to ''tutor'' me in learning how to get this done?

If not, would anyone be able to suggest a more suitable platform to achieve it?

Many thanks in advance,

duBe

28 REPLIES 28
Danish1
Lead II
Posted on March 17, 2015 at 15:25

You don't

need

to multiplex the UARTs.

But that's only if you can find/make a circuit board that wires up the UART pins in such a way that they can be used as UARTs (rather than forcing them to be used for something else).

That's fine if you're designing your own board - but you need a fair degree of competence (or luck) to get this to work first time.

But otherwise (and I would recommend this to the beginner, even if you go on to design your own board) you will be buying a board from a supplier, and if the supplier chose to hard-wire a pin-you-want-to-use-as-a-UART to some other circuitry then it's not always easy to undo their choice.

For example, the STM3210E-Eval has UART3 linked to a IRDA port or shared with the micro-SD card connector, and UART4 to a smart card interface. No mention is made of UART5, but I note that one of the pins is tied to an on-board LCD display.

A lot of the boards will say ''we use processor X that has all these interfaces...''. But they don't follow up with ''Because we've wired up interface Y, interface Z is unavailable''.

Note: You probably only need 4 UARTs because you're only using 4 UART outputs and 1 UART input.

 - Danish

francescatodiego
Associate II
Posted on March 17, 2015 at 18:29

sorry - mistake

Posted on March 17, 2015 at 18:44

I thought the STM32 had five (5) UARTs.I thought I could use one (1) for ''reading IN'' the original RS-232 & the remaining four (4) for ''sending OUT'' the converted RS-232 to the appropriate camera.

Pretty much, but arguably 1 IN, 4 OUT could be done with just four UART for the system you describe. And one

http://www.ti.com/product/max3238

The input side could be done under interrupt, I've posted examples of STM32 USART IRQ. The processing is relatively straight forward.

Is this a personal venture or a business one?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dubedat68
Associate II
Posted on March 18, 2015 at 01:17

Hey Thanks Danish,

that's very helpful info, I didn't realise the boards were ''hobbled'' like that.  I just thought it was like a ''break-out'' board that you could interface your needs to.

Great to know, thanks.

Cheers,

duBe

dubedat68
Associate II
Posted on March 18, 2015 at 01:24

Thanks Clive,

this is a ''personal learning'' project to try to keep my mind active & learn new things along the way.

I'm an old-school motorcycle mechanic (& not a great one at that) but I think my mind is starting to fade, so I thought I'd give it a ''tune-up'' by learning some completely new things.

I have 4 cameras at home that all drive at the same time because of the way they are hard-code-addressed, I always wanted to be able to control them separately but couldn't find anything that would do it.

So, I came up with this idea & thought ''Hey, I could learn something new by trying to make it'', hence this thread.

Cheers,

duBe

Danish1
Lead II
Posted on March 18, 2015 at 11:51

They aren't deliberately hobbled.

They are great platforms for trying things out.

But if you want to use every last UART, then the way STM32 shares pins it inevitably means that some other interfaces are unavailable.

By making a test board that has (say) 2 UARTs, 1 SD-card, 1 infra-red and 1 Ethernet, a manufacturer can satisfy more people's needs than if they had a board that brought out all 5 UARTs. These things sell in small quantities.

You *might* be able to use all the UARTs on the board I mentioned. But you might not. And without studying the schematics closely (and knowing the data sheets on the chips concerned) it's hard to tell without actually trying it. If the LCD is socketed then you can pull it off so it's not a problem. And the same butchery might be possible for the infra-red. You don't need to plug in an SD card into the socket.

You'll need to wire up RS232 level-shifters (like the MAX chip mentioned) for any that don't already have them on your demo board.

Regards,

Danish

dubedat68
Associate II
Posted on March 18, 2015 at 12:31

Hi Danish,

I hope you don't think that I meant some kind of disrespect by using the word ''hobbled'', that was not my intention.

I merely chose that word for expediency sake to convey what I understood you said, in that not ALL of the published features of the module may be available on every board.

I know absolutely nothing about electronics / software and so it is, that my naive choice of words may offend well-seasoned exponents of the art.

I trust that you understand I meant no disrespect to the product; I am, in fact, deeply impressed by what can be accomplished with it.  I just wish I had the knowledge to leverage the possibilities of it.

duBe

Danish1
Lead II
Posted on March 18, 2015 at 13:19

Hi duBe,

I didn't feel any disrespect from your use of the term ''hobbled''. It is a fair comment on the compromises that any designer / manufacturer has to make.

I've had a quick look at the Olimex site, and something like https://www.olimex.com/Products/ARM/ST/STM32-H407/open-source-hardware might suit your project as it has a microcontroller with many I/O pins and not much other hardware attached.

You need to verify that sufficient U(S)ART_TXn pins are free. (Note that the ''n'' has to be different from any that you've already counted).

You need to wire that board up to the RS232 level shifters (MAX chip mentioned before).

You will also need a JTAG interface (Olimex sell them, as do other suppliers). It is important that the JTAG interface is compatible with whichever development IDE you choose.

I cannot be much help with your choice if development IDE because I use a commercial one (Rowley Crossworks). Free ones do exist (e.g. https://www.olimex.com/Products/ARM/JTAG/_resources/OpenOCD/ ) and I suspect they have improved greatly since I made my choice.

But it 

is

 a steep learning curve.

Hope this helps,

Danish

dubedat68
Associate II
Posted on March 19, 2015 at 03:40

Thanks Danish,

much appreciated.

duBe

raptorhal2
Lead
Posted on March 19, 2015 at 15:12

To answer your basic question in detail - The F103 series has USART1 to USART5 tx/rx pins with no conflict with Boot, Reset, oscillator, and programming pins even in the 64 pin package. To verify this, read the part data sheet available on the ST web site.

A Nucleo 103 is an inexpensive prototyping board with all USART pins freely available. The more expensive part will be the custom motherboard to mount the nucleo and provide power, RS-232 converter, connectors, and any other similar functions needed.

The nucleo also provides a Serial Wire Debug (SWD) programming port via a USB connection to an ST-LINK driver in your PC. You will need an IDE compatible with your software developer IDE to download and troubleshoot the application software, and to carry on with any future development.

If you are communicating with clive1, he can certainly provide excellent guidance to producing a finished product.

Cheers, Hal