# UART buffer data size =\> event

**URL:** <https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320>\
**Category:** Open AT\
**Created:** [June 9, 2009, 5:05pm UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320 "2009-06-09T17:05:15Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenFT01](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@BenFT01](https://forum.sierrawireless.com/u/BenFT01)\
**Post date:** [June 9, 2009, 5:05pm UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/1 "2009-06-09T17:05:15Z")

</div>

Is there a way to control the amount of data at the uart input required to generate an event? There could also be a timer to control when to generate an event after data has started to arrive. I want to start processing the input data earlier, rather than waiting for the whole message to arrive.

This is because I need to detect from the signalling at the start of the message what the baud rate is, then switch it before the rest of the message comes in. I’m not sure this is possible with the API we are presented with.

Any hints would be appreciated.

---

<div class="post-metadata">

**Author:** ![blackyblack](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@blackyblack](https://forum.sierrawireless.com/u/blackyblack)\
**Post date:** [June 9, 2009, 5:37pm UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/2 "2009-06-09T17:37:19Z")

</div>

You can subscribe to unsolicited events on UART. AFAIR you will get an event on every new char typed in. But I’m not sure you will be able to translate data from one baudrate to another.

---

<div class="post-metadata">

**Author:** ![blackyblack](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@blackyblack](https://forum.sierrawireless.com/u/blackyblack)\
**Post date:** [June 10, 2009, 4:11am UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/3 "2009-06-10T04:11:10Z")

</div>

Oops, my bad. Use FCM facility instead.

---

<div class="post-metadata">

**Author:** ![BenFT01](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@BenFT01](https://forum.sierrawireless.com/u/BenFT01)\
**Post date:** [June 10, 2009, 8:29am UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/4 "2009-06-10T08:29:39Z")

</div>

Thanks PennyBlack, but the issue is with a input char rate of say 240 chars per sec from a device, you don’t get an event for each char, you get a chunk of chars in the input buffer.  
Unless you are pointing to something else?

---

<div class="post-metadata">

**Author:** ![blackyblack](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@blackyblack](https://forum.sierrawireless.com/u/blackyblack)\
**Post date:** [June 10, 2009, 10:17am UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/5 "2009-06-10T10:17:19Z")

</div>

So what? Why don’t you like data in buffer?

---

<div class="post-metadata">

**Author:** ![BenFT01](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@BenFT01](https://forum.sierrawireless.com/u/BenFT01)\
**Post date:** [June 10, 2009, 10:20am UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/6 "2009-06-10T10:20:01Z")

</div>

Because if the baud rate of the message is different from what the port is currently set to, the data will be incorrect.

---

<div class="post-metadata">

**Author:** ![blackyblack](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@blackyblack](https://forum.sierrawireless.com/u/blackyblack)\
**Post date:** [June 10, 2009, 11:46am UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/7 "2009-06-10T11:46:00Z")

</div>

But if the baudrate is incorrect the very first char will be incorrect. How are you going to correct it? And if you have higher baudrate on receiver than on transmitter you will get only a part of char and information about sent char will be lost.

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [June 10, 2009, 12:15pm UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/8 "2009-06-10T12:15:00Z")

</div>

> [@Ben FT](#):
>
> PennyBlack

😃😆

> [@blackyblack](#):
>
> But if the baudrate is incorrect the very first char will be incorrect. How are you going to correct it?

He said he wants to autobaud.

But I don’t think that’s possible?

---

<div class="post-metadata">

**Author:** ![BenFT01](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@BenFT01](https://forum.sierrawireless.com/u/BenFT01)\
**Post date:** [June 10, 2009, 12:29pm UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/9 "2009-06-10T12:29:48Z")

</div>

Ooops, sorry about the name BlackyBlack, I remembered it wrong. 😊

The system I am connecting to has two possible baud rates, 1200 and 2400. There is a string of a specially choosen char at the beginning of the message. If you read these at 2400 you get one type of char, at 1200 a different char so you can work out which baud rate is required. Then you switch the baud rate of the port and read the rest of the message correctly. Not nice, but it works where you have low level control of the uart.

I just found in the user guide that the baud rate can not be changed while the port is in the data state, so I would have to switch it to AT mode then back. No idea how fast the FSU will respond to this. Not looking likely. ☹

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [June 10, 2009, 1:10pm UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/10 "2009-06-10T13:10:04Z")

</div>

Doest the sender repeat the message if it doesn’t get a response?

If it does, you should be fine:

- If you are already at the correct rate, you can just respond immediately;
- If you are at the wrong rate, ignore it and change rate - then you will be at the right rate when it re-sends…

1.

---

<div class="post-metadata">

**Author:** ![BenFT01](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@BenFT01](https://forum.sierrawireless.com/u/BenFT01)\
**Post date:** [June 10, 2009, 1:17pm UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/11 "2009-06-10T13:17:29Z")

</div>

That’s the easy way out awneil! 😉

There is no handshaking unfortunately but there is generally a retransmission, but this is a last port of call as the messages are prone to error. The optimum is to switch mid-message. Think I’m going to be relying on the re-transmission though …  
It not a nice network to talk to! 😒  
Thanks for the thoughts.

---

<div class="post-metadata">

**Author:** ![BenFT01](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@BenFT01](https://forum.sierrawireless.com/u/BenFT01)\
**Post date:** [June 10, 2009, 1:27pm UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/12 "2009-06-10T13:27:35Z")

</div>

There are similar controls to the ones I am interested in if you make a virtual com port mux (+CMUX), but I guess these are all going to be multiples of the existing timing/buffer fullness. It talks about 20ms being the minimum unit there. That would be 5 chars at 2400 baud. That would work. The default is 100 ms, ie 20 chars which is roughly what I see. Perhaps I set up a single virtual port and use these controls?  
Worth a shot.  
Hummm … lowest baud is 9600 in this case.  
N1 and T1 are the interesting parameters.  
Close but perhaps not close enough.

---

<div class="post-metadata">

**Author:** ![BenFT01](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@BenFT01](https://forum.sierrawireless.com/u/BenFT01)\
**Post date:** [June 10, 2009, 4:37pm UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/13 "2009-06-10T16:37:57Z")

</div>

Humm… ADL\_User\_Guide p426 Open UART Interface. “Direct access to the Wireless CPU UART Service Providers” what ever they are, but sounds promising.  
p431 talks about fd\_cap - fifo depth capability  
min\_dur\_rx  
p439 talks about UART\_FD\_BOTH\_OFF to turn off UART buffers and the rx\_size “the UART service provider’s reception trigger level”

all sounds good but its not obvious to me how its all used. Any one using Open UART interface? So far I have used FCM only.

---

<div class="post-metadata">

**Author:** ![blackyblack](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@blackyblack](https://forum.sierrawireless.com/u/blackyblack)\
**Post date:** [June 11, 2009, 5:15am UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/14 "2009-06-11T05:15:30Z")

</div>

I guess noone used it. It’s pretty unpopular service 🙂  
But Open UART is possibly what you need cause it provides a low level control of UART.

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [June 11, 2009, 6:39am UTC](https://forum.sierrawireless.com/t/uart-buffer-data-size-event/3320/15 "2009-06-11T06:39:22Z")

</div>

> [@blackyblack](#):
>
> I guess noone used it. It’s pretty unpopular service 🙂

It’s quite new, so there obviously isn’t the “body of experience” as for good ol’ FCM…

There have been plenty of posts on this forum from people trying to use it…
