EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Is an additional 8051 microcontroller necessary?

Started by mik3ca 5 years ago2 replieslatest reply 5 years ago57 views

I ran into an interesting situation as I'm developing my large system.

As it stands now, the server continuously addresses each client with 11 bytes of data, mostly nulls. except for one client that's connected, I increment its (the clients) data field by 1 in the server end. The server uses the higher speed micro (AT89LP52).  The server also gives each client a 20mS timeout to respond back to the server before the server moves on to the next client.

I made my computer a temporary client and all I had it do is log the data and so fat the data is completely valid and in fast time, so nothing is wrong with the server.

Now comes the client.

I made myself a large serial number display unit in which the numbers are updated after shifting 32 bits in. 

The client's job is to receive the packet from the server, verify that the checksum is correct and if it is then it does the following in order:

1. validate the received packet and only continue if checksum is correct and the packet is for the client

2. transmit whatever data is in the transmission buffer

3.  takes the 3rd and 4th bytes as an integer, and converts that integer into separate digits in memory

4, convert those digits to proper format for number display then shift all bits

I used simulation software to measure steps 3 and 4, and it reported the time it takes to complete those steps without any interrupt happening is 512uS. That's a huge number since a character arrives in less time. There is no other process in the client that hogs time like this.

Speaking of character reception, I noticed something unusual.

If I set the UART baud rate on all microcontrollers to 56kbps, then it looks as if data transfer is going partly smoothly. At least I see the updates on the big number board at the rate of 2X a second.

Now I ran another experiment. This time, I changed the UART baud rate to 38kbps, and even though the wireless modules indicated that the server and client were talking to each other, I noticed the number display not updating at all. So I then I decided to up the timeout from 20mS to 32mS. This time the numbers were updating.

Now here's another thing... Because I'm using wireless modules, I find that the maximum distance between the two modules for communication is based on UART speed. The higher the speed, the lower the distance. 

Because I need the numbers to update at least 4x a second, the only thing tempting is to increase the UART speed to 115200bps but the range might be too short.

I'm tempted to rip out the radio module and add a bridge between each radio module and each client and server to act as a data buffer and checksum processor.  Am I going overkill style with the thought of adding another mini microcontroller (like the AT89C4051) just for filtering out packets?

Another thing I thought of which might cause choking at the radio module level is set all UART speeds to 115200bps and the radio module air speed to 57600bps, but if I did that, what sort of disadvantages can I expect?



[ - ]
Reply by jkvasanJanuary 15, 2019

Hi mik3ca,

OMG, a lot of information and multiple questions.

1. As you have not specified which wireless technology, I assume it is a simple 434MHz kind of transceiver. If you want to work on 115200, then either go to ZigBee or Wifi modules. They are available for a dime a dozen, nowadays.

2. Query-Response window time : When increased to 32 msec, your communication is ok @ 32 MHz. Does your MCU have a DMA. Direct Memory Access peripheral helps in saving valuable processor time and directly picks up data and sends through the serial port without involving the CPU. If you could use this option (if available), it will enhance instant response.

3. Coming to your subject line, you may use the PC as the server and write a simple code to check CRC.


Cheers

jkvasan

[ - ]
Reply by mik3caJanuary 15, 2019

I'm trying to NOT make the PC as my final server because if my PC ever gets a virus while my system is running then the system shuts down because of a virus.

Sadly I don't have the fancy features the modern PC has. No DMA. It's an 8051 based processor with options for a few interrupt handlers (one for serial which I'm using) and limited ram.

Here's more information about the chip that I am using for the server: http://www.keil.com/dd/chip/5606.htm

The radio module I'm using is 915Mhz and model number is HM-TRP. I chose it because it has an easy to use UART interface. The only other module I could get are ones from e-byte technology which has sort-of a similar interface.

The 2024 Embedded Online Conference