4800 P_UART Baudrate

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

I finally got around to spending a few days working with the BCM920737TAG3 board, and am starting to get the hang of it. I even managed to get 2.2.2 running.

However, one of my main requirements remains a baudrate of 4800.

I seem to have two options:

1) get it to work natively, even if this is not officially supported. (4800 UART Baudrate)

2) write a software uart, that would use one of the PWM outputs or the new bt_clock_based_timer for bitbanging TX and a timer combined with a pin interrupt for RX

as you can imagine, I'd prefer 1)

I spent many hours trying to get 1) to work, but have not yet managed.

    tw_puart_init(GPIO_PIN_UART_RX, GPIO_PIN_UART_TX,4800);

    P_UART_HIGH_BAUDRATE_DIV(0x44); //set the registers directly

    P_UART_LOW_BAUDRATE_DIV(0xC8);

I tried using the functions I could find in puart.h (tw_puart_init() and puart_calculateBaudrate()), as well as using the two macros above to set the divisor registers directly. While this worked for almost any baudrate, I could not get 4800 to work. (P_UART would output at 26607 baud when set to 4800). Unfortunately, There is no obvious logic as to how "dhbr" and "dlbr" need to be calculated, or how they might be used by the internal hardware to actually genrate the output. It is obviously not just a 16 bit "divisor" for the clock that's split into two 8 bit registers, as I'm used to from other systems. I tested at least 40 different baudrates at known intervals, to see if I could find some patterns in the binary representation of the two registers, to no avail.

If someone from broadcom could give me some pointers in which direction to continue, or even better: provide an actual solution, that would be the best. getting some "real" documentation of the hardware would be great.

I have three more ideas before I start working on a software uart, but I can't figure out how to try them, as the documentation is lacking concerning these things:

a) Slow the entire CPU down from 24 to 12Mhz, and hope that 4800 baud will then work with the divisor settings of 9600 at 24Mhz.

     as I will almost definitely need some lower power modes while the radio can be completely off, this might be interesting anyway - It would be great if I could get more info on this (eg what the lowest speed is at which Bluetooth will still work)

b) use a different clock for P_UART - I already figured out how to use the auxiliary clock for PWM, and how to configure that to use either the 24MHz or 1MHz as the reference to generate pretty much any frequency (pwm_tones app is great!). I could not find any (documented) methods of using one of the ACLK's for P_UART.

c) somehow manage to increase the sampling (constant P_UART_SAMPLE_CLOCK) from 16 to 32, which should get me down to 4800 baud with the settings for 9600 baud.

If anyone has some ideas for me, I'd be very happy to hear them!

Thanks already!

0 Likes
2 Replies