# add a UART port

**URL:** <https://forum.sierrawireless.com/t/add-a-uart-port/3080>\
**Category:** General\
**Created:** [March 30, 2009, 11:03am UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080 "2009-03-30T11:03:32Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![rblode\_new](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@rblode\_new](https://forum.sierrawireless.com/u/rblode_new)\
**Post date:** [March 30, 2009, 11:03am UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/1 "2009-03-30T11:03:32Z")

</div>

Hello ,  
i want to know is it possible to add virtual port used two GPIO for tx and rx uart in the wavecom q2687 , if it is possible there is somone that you have an example please or an idea !

Thank you .

Regards

---

<div class="post-metadata">

**Author:** ![Madouc](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@Madouc](https://forum.sierrawireless.com/u/Madouc)\
**Post date:** [March 30, 2009, 11:46am UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/2 "2009-03-30T11:46:11Z")

</div>

no, can’t be done.

what you can do is connect one using spi or i2c

although, you really need more than two(three if you cont usb) serial ports?

---

<div class="post-metadata">

**Author:** ![rblode\_new](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@rblode\_new](https://forum.sierrawireless.com/u/rblode_new)\
**Post date:** [March 30, 2009, 12:07pm UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/3 "2009-03-30T12:07:25Z")

</div>

Thak you for your answer  
I need two UART in my program but i want to keep UART1 for debug.

Regards.

---

<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:** [March 30, 2009, 12:12pm UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/4 "2009-03-30T12:12:15Z")

</div>

> [@rblode\_new](#):
>
> I need two UART in my program but i want to keep UART1 for debug.

It is possible to use a UART for both debug and application comms - see: [viewtopic.php?f=53&t=2509&p=11123&hilit=external+com#p11123](http://www.wavecom.com/modules/movie/scenes/forums/viewtopic.php?f=53&t=2509&p=11123&hilit=external+com#p11123)

---

<div class="post-metadata">

**Author:** ![rblode\_new](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@rblode\_new](https://forum.sierrawireless.com/u/rblode_new)\
**Post date:** [March 30, 2009, 1:06pm UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/5 "2009-03-30T13:06:55Z")

</div>

Thank you but it isn’t clear for me , you can give me some details .

Regads

---

<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:** [March 30, 2009, 1:17pm UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/6 "2009-03-30T13:17:23Z")

</div>

Have you read the description in the Tools Manual?

Which part(s), precisely, is/are not clear?

---

<div class="post-metadata">

**Author:** ![jacfry](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@jacfry](https://forum.sierrawireless.com/u/jacfry)\
**Post date:** [March 30, 2009, 6:41pm UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/7 "2009-03-30T18:41:34Z")

</div>

I successfully managed to use GPIO as software UART, but the highest possible baudrate is 1200bps. Any higher baud rate is not possilbe right now.

---

<div class="post-metadata">

**Author:** ![rblode\_new](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@rblode\_new](https://forum.sierrawireless.com/u/rblode_new)\
**Post date:** [April 1, 2009, 10:36am UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/8 "2009-04-01T10:36:25Z")

</div>

You can help me to do this !

---

<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:** [April 1, 2009, 12:19pm UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/9 "2009-04-01T12:19:26Z")

</div>

Wouldn’t adding an SPI- or I2C-connected UART be simpler?!

---

<div class="post-metadata">

**Author:** ![rblode\_new](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@rblode\_new](https://forum.sierrawireless.com/u/rblode_new)\
**Post date:** [April 1, 2009, 1:11pm UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/10 "2009-04-01T13:11:40Z")

</div>

i want to use the i2c and spi in the next version of my software but if there isn’t a solution i have no choice

---

<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:** [April 1, 2009, 1:46pm UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/11 "2009-04-01T13:46:25Z")

</div>

I2C is certainly a bus connection, and SPI can be - so the fact the you put one device on doesn’t (necessarily) preclude adding other devices…

---

<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:** [April 1, 2009, 1:50pm UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/12 "2009-04-01T13:50:50Z")

</div>

Have you actually looked carefully at using the TMT+TE facilities yet?

That way, you wouldn’t require any extra devices at all! 😃

---

<div class="post-metadata">

**Author:** ![rblode\_new](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@rblode\_new](https://forum.sierrawireless.com/u/rblode_new)\
**Post date:** [April 2, 2009, 9:57am UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/13 "2009-04-02T09:57:47Z")

</div>

Thank you awneil for your help , i will use th TMT+TE .

---

<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:** [April 3, 2009, 4:07am UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/14 "2009-04-03T04:07:47Z")

</div>

I2C actually doesn’t work. So it is not a good idea to recommend it. As far as I know SPI also has a bunch of bugs. And since Q2686 has only 2 UART it is useless without external processor in somewhat complex applications.

---

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.sierrawireless.com/u/davidc)\
**Post date:** [April 3, 2009, 4:30am UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/15 "2009-04-03T04:30:44Z")

</div>

Hiya,

> [@blackyblack](#):
>
> I2C actually doesn’t work. So it is not a good idea to recommend it. As far as I know SPI also has a bunch of bugs

Both I2C (@ 100kHz) and SPI (@2MHz) are working fine for me on the Q2686, OS R7.1 - R7.3.

Both SPI & I2C are running as Masters.

The API is a little tricky to get your head around, but otherwise, no problems.

ciao, Dave

---

<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:** [April 3, 2009, 7:19am UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/16 "2009-04-03T07:19:15Z")

</div>

> [@blackyblack](#):
>
> since Q2686 has only 2 UART it is useless without external processor in somewhat complex applications.

How many other modules on the market have \>2 UARTs?

---

<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:** [April 3, 2009, 10:12am UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/17 "2009-04-03T10:12:39Z")

</div>

I don’t know which modules have more than 2 UARTs but I know that every module on market has at least 1 UART and much lower price. If used with external processor cost and extendability of the final device could be reduced dramatically.

---

<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:** [April 3, 2009, 10:12am UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/18 "2009-04-03T10:12:57Z")

</div>

> [@](#):
>
> Both I2C (@ 100kHz) and SPI (@2MHz) are working fine for me on the Q2686, OS R7.1 - R7.3.

My I2C code freezes after 10 minutes of using. The only difference is that on R7 it does not freeze the entire application - multitasking in action. 🙂

I’d love to see your I2C code to compare with. Probably wavecom’s I2C just does not work properly with clock stretching mode and the overall result depends on slave. Also I have not seen succesfull using of multiple slaves with wavecom module. Have you tried it?

With SPI I’ve heard rumors about CS problems. But I haven’t tried it.

---

<div class="post-metadata">

**Author:** ![Madouc](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@Madouc](https://forum.sierrawireless.com/u/Madouc)\
**Post date:** [April 5, 2009, 3:38pm UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/19 "2009-04-05T15:38:23Z")

</div>

> [@blackyblack](#):
>
> > [@](#):
> >
> > Both I2C (@ 100kHz) and SPI (@2MHz) are working fine for me on the Q2686, OS R7.1 - R7.3.
> 
> My I2C code freezes after 10 minutes of using. The only difference is that on R7 it does not freeze the entire application - multitasking in action. 🙂
> 
> I’d love to see your I2C code to compare with. Probably wavecom’s I2C just does not work properly with clock stretching mode and the overall result depends on slave. Also I have not seen succesfull using of multiple slaves with wavecom module. Have you tried it?
> 
> With SPI I’ve heard rumors about CS problems. But I haven’t tried it.

so did my q2686 in I2C-comm  
problems arose indeed with clock-stretching, wrong pullup-resistor values and also with disturbences in the 3v3 pullup voltage. (is still kills the whole processor even on R7.x)

i’m currently using 2 nxp led-dimmers (on th I2C bus).

i’ve had no problems with SPI so far.

---

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.sierrawireless.com/u/davidc)\
**Post date:** [April 6, 2009, 3:06am UTC](https://forum.sierrawireless.com/t/add-a-uart-port/3080/20 "2009-04-06T03:06:01Z")

</div>

Hiya,

> [@blackyblack](#):
>
> Probably wavecom’s I2C just does not work properly with clock stretching mode and the overall result depends on slave. Also I have not seen succesfull using of multiple slaves with wavecom module. Have you tried it?

I’ve only got one I2C slave - a Maxim/Dallas DS2482-100 I2C to One-Wire bridge. Haven’t tried clock streching as I didn’t need to. However, I have my I2C bus running through a bi-directional level shifter (the One-Wire stuff runs off 5V, and won’t quite run down to 2.8V. Sigh!) - so Q26 side of the bus is pulled up to the Q26 supplied 2V8, and the other side of the bus is pulled up (quite hard) to 5V. This may be why I haven’t seen the problems that Madouc is referring to.

Here’s the I2C bus set-up code I use:

```auto
const adl_busI2CSettings_t DS2482Config = 
{
    0x18, // device address = 0x18
    ADL_BUS_I2C_CLK_STD, // standard bus speed (100kHz)
    ADL_BUS_I2C_ADDR_7_BITS, // 7 bit address mode
    ADL_BUS_I2C_MASTER_MODE // Q2686 is Bus Master
};

const adl_busAccess_t DS2482BusAccess = 
{
    0, // address = 0
    0 // no op-code
};

/ *************************************************************************** /
/* Globals */
/ *************************************************************************** /

// bus handles
s32 DS2482I2CHandle;

// data buffers
u8 DS2482WriteBuffer[DS2482_WRITE_SIZE], DS2482ReadBuffer[DS2482_READ_SIZE];

/ *************************************************************************** /
/* Functions */
/ *************************************************************************** /

bool DS2482_busSubscribe()
{
    u32 DataSize = 8;
    
    DS2482I2CHandle = adl_busSubscribe( ADL_BUS_ID_I2C, 1, (adl_busI2CSettings_t *)&DS2482Config );
    
    TRACE (( DS2482_TRACE_BUS , "DS2482_busSubscribe(): DS2482I2CHandle = %d", DS2482I2CHandle ));
    
    adl_busIOCtl (DS2482I2CHandle, ADL_BUS_CMD_SET_DATA_SIZE, &DataSize);

    wm_memset( DS2482WriteBuffer, DS2482_WRITE_SIZE, 0);
    wm_memset( DS2482ReadBuffer, DS2482_READ_SIZE, 0);
    
    return TRUE;
}

extern bool DS2482_busUnSubscribe()
{

    TRACE (( DS2482_TRACE_BUS , "DS2482_busSubscribe()" ));
    adl_busUnsubscribe(DS2482I2CHandle);

    return TRUE;
}
```

My previous experiences with I2C on other micros was not all that great - had lots of problems with choice of pull-ups and track layout - especially with multiple devices, so tended to steer away from it where I could.

> [@blackyblack](#):
>
> With SPI I’ve heard rumors about CS problems. But I haven’t tried it

I had grief using the ADL\_BUS\_SPI\_ADDR\_CS\_HARD option and ended up using the ADL\_BUS\_SPI\_ADDR\_CS\_GPIO option for Chip Select. I then used the GPIO that corresponded to the CS pin on the Q26. Again, I only have a single device on the bus, and aren’t doing any mode or speed switching.

Getting all the bus stuff running was not all that straightforward - especially decoding what Wavecom mean when the API is talking about op-codes and addressing in the adl\_busAccess\_t structure. I spent a lot of time experimenting by sending data down the bus and staring at CRO screen captures to see what actually was happening.

ciao, Dave

[Next page](https://forum.sierrawireless.com/t/add-a-uart-port/3080.md?page=2)
