cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 - Serial Comms with 9 bit data PLUS parity - How to go about it..

gmamo
Associate II
Posted on January 23, 2011 at 01:34

STM32 - Serial Comms with 9 bit data PLUS parity - How to go about it..

34 REPLIES 34
Andrew Neil
Evangelist
Posted on May 17, 2011 at 14:22

clive1:''try connecting it to your PC''

Of the schemes that I've seen for doing 9-bit comms on a PC, they all rely upon ''tweaking'' the parity bit - so none of them would be able to give 9 bits plus  parity!

Again, it would be strictly either  9 bits or  parity!

As you say, the ATMega does seem to be very much ''an outlier not the norm'' in this respect.

Maybe this display thing is specifically designed for use (only) with AVRs?

Is it, perhaps, an Arduino (sp?) thing...?
Andrew Neil
Evangelist
Posted on May 17, 2011 at 14:22

PICguy:''I’ve used RS-232 for at least 30 years''

 

 

Note that this has nothing (specifically) to do with RS232.

In fact, most 9-bit networks are multi-drop  - so they cannot use RS232!

(unless they are unidirectional, I suppose)

Multi-drop is specifcally what this 9-bit scheme is designed for.

gmamo
Associate II
Posted on May 17, 2011 at 14:22

 

Andrew Neil
Evangelist
Posted on May 17, 2011 at 14:22

''Straight away onto

http://www.nxp.com/documents/user_manual/UM10360.pdf

...same for the

http://ics.nxp.com/support/documents/microcontrollers/pdf/user.manual.lpc13xx.pdf

...''

If they do what you require, then use them!

There is no point fighting the STM32 if it doesn't (quite) do what you need!

NXP have some very low cost boards available - so it should be easy enough to try one to confirm that it actually does what you need...

An alternative, as you already have this working on an AVR, might be to use the smallest AVR you can just for the comms, and have an STM32 (or whatever) do all the ''Heavy Lifting''...
gmamo
Associate II
Posted on May 17, 2011 at 14:22

 

Posted on May 17, 2011 at 14:22

The SPI solution would be kind of kludgy. You could get close to 9600 by using the APB1 bus (ie SPI2 or SPI3), and tuning the AHB, APB1 prescalers, and running the STM32 at about ~39.32 MHZ. I don't think running the APB1 at 2.4576 MHz would be a problem, but depends what else you plan on doing. A 4.9152 MHz crystal is available, and would be compatible with the PLL 4-16 MHz input requirements.

You could also perhaps program a USART at 9600 and synchronous, and use it's clock feed back as a slave SPI clock. The TIM's could also generate a 9600 Hz with minimal effort.

Much of this depends how creative/out-of-the-box you're willing to get.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
John F.
Senior
Posted on May 17, 2011 at 14:22

If you're going to get THAT creative, why not just write a software UART dirving a GPIO pin directly? It looks like the application doesn't need to send data all that often.

Andrew Neil
Evangelist
Posted on May 17, 2011 at 14:22

Just out of interest, do you know if the NXP parts do support both  parity and  9-bit together?

gmamo
Associate II
Posted on May 17, 2011 at 14:22

 

krk2
Associate II
Posted on May 17, 2011 at 14:22

@digi-picavr

Hi,

do you have any new information related to your problem with the jeti box ? I have now exactly the same problem 😉  At the moment I think I must generate the signal by hand without hw support.