I am currently at the start of a project which i'm currently scoping out, but one part of this project will require a micocontroller to run as an ethernet to RS422 bridge. As much as i've had a general interest in microcontrollers, ive never had the chance to use one... until now. I have done a reasonable amount of C programming + general design work as an engineer but nothing that has required a microcontroller.
My microcontroller application is to interface between a host PC, running Windows XP and a device that runs async RS422 busses at 10Mb/s. This solution has to be an external "plug in" to the existing PC eg no add in PCI cards and USB not an ideal interface for this setup, hence me looking to "roll my own" RS422 interface. The interface would be primarily used to transmit data, continually to the RS422 device, with the microcontroller bridging the data transmit from the host PC via ethernet to RS422 10Mb/s. Data could be transmit from the host PC a single 9 bit data word at a time so I don't have any need for large FIFOs or memory buffers, nor is there any timing requirements for the interval between data words.
I realise this is a very broad question but in general is what would be a good suite of products to begin with? My research so far has found 32 bit MCUs somewhat commonly have an ethernet port, just requiring the magnetics / resistors to complete the interface. Can anyone recommend a device which is readily available, a dev board containing the same device w/ethernet port implemented + debugger / emulator to use. Raw cost overall on this is generally nor important, as it will be a "one of " built so development time will be the far more costly factor.
In addition to this general recommendation, i have two questions that come to mind;
The first one is the handshaking on the device i am communicating with is a little odd. It receives "9N1" serial data, but acknowledges this with two bits, effectively a start and stop bit, no data. I can't see any UART that allows you to configure the receive data to be 0 data byes, and i guess for good reason. handshaking is the same in both directions, so if the device transmits data, I have to ack each 9N1 word with the same 2 bit ack. My only thought here is to have OR gates, logically OR a UART output with a GPIO output to either transmit data via the UART or provide an ack with the GPIO output. This OR'd output would then drive my RS422 transceiver. This setup would be mirrored for the receive side with the transceiver being directly connected to a UART port + GPIO port for detection of the ack bits. My question is, is there a better way to do this internal to the micro controller itself ? Can i switch a microcontroller port between being a UART or a GPIO on the fly, depending on if i am transmitting or receiving? I am asking this question now as it may relate to the functionality available in the device I use. I would prefer to not use a bit bang transmitter/receiver on GPIO pins when I have perfectly good UARTs available.
Secondly, it would be ideal if I can program this device in its end environment without the need for a USB style programming / debugger. Essentially if I placed a brand new device on the PCB, I could detect it is blank / not functioning and then load the required software image. I have a bunch of GPIOs available to use in the host PC which I have used for I2C / SPI interfaces previously, which i could potentially use to program the microcontroller or external flash / EEPROM if this was easier to program. Is there any solution here which is possible? I would easily be able to write a routine to drive an SPI bus to write data 'x' to address 'y' and repeat for each byte in the image to be programmed. If there are masses of different message types / formats / sequences that have to go over the SPI bus to program a device, then it would be too much to implement.
Any suggestions welcome.