uart module and 9 bit characters

classic Classic list List threaded Threaded
3 messages Options
Louis Mamakos Louis Mamakos
Reply | Threaded
Open this post in threaded view
|

uart module and 9 bit characters

I'm working on a little project where I want to drop an STM32F103RB based eLua "stamp" module (from Futurlec) on an RS-485 multi-dropped serial bus.  The protocol in question uses 9-bit characters, with the 9th bit being set to indicate an "address" for the frame.  This seems a common trick with some embedded controllers that can turn off interrupts from the UART until a frame with the right 9-bit address starts by to wake up the serial port and collect the rest of the frame.  I have, of course, an RS-485 transceiver to interface to the UART 1 peripheral on the STM32 CPU.

I'm not yet trying to do anything clever in the filtering operation, but it looks like despite being able to set the UART in 9 bit mode with uart.setup(), only 8 bits seem to get passed around inside eLua.  And there doesn't seem to be an user API that returns other than individual characters or strings.  Has anyone done any work in this area?  I thought I'd ask around a bit prior to contemplating doing violence to the existing code.

Thanks in advance for your help or suggestions.

Louis Mamakos

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: uart module and 9 bit characters

Hi,

On Sat, Nov 19, 2011 at 12:38 AM, Louis Mamakos <[hidden email]> wrote:
I'm working on a little project where I want to drop an STM32F103RB based eLua "stamp" module (from Futurlec) on an RS-485 multi-dropped serial bus.  The protocol in question uses 9-bit characters, with the 9th bit being set to indicate an "address" for the frame.  This seems a common trick with some embedded controllers that can turn off interrupts from the UART until a frame with the right 9-bit address starts by to wake up the serial port and collect the rest of the frame.  I have, of course, an RS-485 transceiver to interface to the UART 1 peripheral on the STM32 CPU.

I'm not yet trying to do anything clever in the filtering operation, but it looks like despite being able to set the UART in 9 bit mode with uart.setup(), only 8 bits seem to get passed around inside eLua.  And there doesn't seem to be an user API that returns other than individual characters or strings.  Has anyone done any work in this area?  I thought I'd ask around a bit prior to

I don't think anybody tried to support 9-bit UARTs until now. Sorry for the bad news.

Best,
Bogdan
 
contemplating doing violence to the existing code.

Thanks in advance for your help or suggestions.

Louis Mamakos

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: uart module and 9 bit characters

On Sat, Nov 19, 2011 at 6:31 PM, Bogdan Marinescu
<[hidden email]> wrote:

> Hi,
>
> On Sat, Nov 19, 2011 at 12:38 AM, Louis Mamakos <[hidden email]> wrote:
>>
>> I'm working on a little project where I want to drop an STM32F103RB based
>> eLua "stamp" module (from Futurlec) on an RS-485 multi-dropped serial bus.
>>  The protocol in question uses 9-bit characters, with the 9th bit being set
>> to indicate an "address" for the frame.  This seems a common trick with some
>> embedded controllers that can turn off interrupts from the UART until a
>> frame with the right 9-bit address starts by to wake up the serial port and
>> collect the rest of the frame.  I have, of course, an RS-485 transceiver to
>> interface to the UART 1 peripheral on the STM32 CPU.
>>
>> I'm not yet trying to do anything clever in the filtering operation, but
>> it looks like despite being able to set the UART in 9 bit mode with
>> uart.setup(), only 8 bits seem to get passed around inside eLua.  And there
>> doesn't seem to be an user API that returns other than individual characters
>> or strings.  Has anyone done any work in this area?  I thought I'd ask
>> around a bit prior to
>
> I don't think anybody tried to support 9-bit UARTs until now. Sorry for the
> bad news.

We're actually setting up the hardware properly for it, but the data
types we use to return the values aren't large enough (since they're
u8).  So, you could probably get around this by using a larger data
type for passing those values around or perhaps we could have a
"uart_data" type of some sort that could be defined to a wider type to
allow passing 9-bit values?

There are some complexities to making this work though since the UARTS
can be buffered using the buf component, but if you simply make it
16-bits per char and make sure that changes get replicated out
appropriately where UART data might get processed it might not be too
complicated to implement.

> Best,
> Bogdan
>
>>
>> contemplating doing violence to the existing code.
>>
>> Thanks in advance for your help or suggestions.
>>
>> Louis Mamakos
>>
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev