This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2652R: Wrong UART baud rate when running on custom board

Part Number: CC2652R

Hello,

I am currently bringing up a custom board with a CC2652R processor. I am looking at running two programs on it, one is Project Zero and the other is a modified version of Project Zero with my own custom services (call it Project One). When running either program on the launchpad and opening up a serial 115,200 connection through Putty, the UART works fine and I can see my debug statements (that use the log_info functions). However, when I run both programs on my own test board, the UART baud rate changes. In particular, I get a 40,000 rate for Project Zero and 76,000 rate for Project One. I can verify this works by opening up a Putty connection at those rates, and the debug statements print correctly. Otherwise random characters are printed.

I have verified that the UART registers are the same when running on both the launchpad and my own board. On my own board with Project One, I am using an external 48 MHz clock for SCLK_HF and a low-frequency clock derived from XOSC for SCLK_LF. I have verified SCLK_HF by outputting a PWM signal on a DIO, and I have verified SCLK_LF to be 32 kHz by outputting it to a DIO. Based on the datasheet, the UART should be taken from PERDMACLK, which I think should be 48 MHz but I can't check because it is internal.

Are there other registers that need to be changed when initializing UART on a custom chip? I think the only relevant functions that I am running from Project Zero are:

Board_initGeneral()
UART_init()
UartLog_init(UART_open(CONFIG_DISPLAY_UART, NULL))

Also, why would Project Zero and Project One be giving different baud rates? If Project Zero is running off of RCOSC and Project One off of XOSC, could that be affecting things? RCOSC should be automatically calibrated from the syscfg file.

Thank you, I appreciate the help!

Adam

  • Hi Adam,

    Those errors do seem challenging. I'm not sure why you're seeing the incorrect and varying baud rates, but I'd recommend looking at our XTAL selection guide to make sure you're using the right crystals for good timing. Make sure you're using one of the recommended crystals, as well as following the reference design as closely as possible. Also feel free to post your schematic/layout here too if you still can't figure out the error.

  • Hi Nathan,

    Thanks for the suggestion! I think the issue might be that the clock I am using only goes to 48 MHz at its 3rd overtone. So I will try to use the RCOSC instead of XOSC for now.

    I managed to get the RCOSC set up for both SCLK_LF and SCLK_HF and verified it with the clock tests I mentioned before, but I am now having a new issue. When running simple peripheral on my custom board, I am getting stuck in the SimplePeripheral_init function and more specifically at the call to:

    GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, attDeviceName);

    Based on my breakpoints and debug statements I think it is entering this function and crashing to the ICall_abort function in icall.c. I'm not exactly sure how to debug this because its an API call, and the other API call further up in the init function, ICALL_registerApp(...) returns success.

    Anything you would recommend to debug this?

    Thanks for the help,

    Adam

  • Hi Adam, can you try four things for me?

    1. Try to run the unaltered code (directly from the SimpleLink Academy) on your launchpad

    2. Try to run the unaltered code (directly from the SimpleLink Academy) on your device

    3. Try to run the code that you altered from the example on your launchpad

    4. Try to run the code that you altered from the example on your device

    This should help us understand if the error is in software or hardware.

  • Hi Nathan,

    1 and 3 work (as in they broadcast a signal from the antenna that can be picked up by my phone or BTool), but 2 and 4 do not work. They get stuck after the call to the function I reference above. I am running Project Zero as the unaltered code. If I run the code then hit "pause", #2 seems to be stuck in CPUwfi, which seems ok but none of the debug statements print out before that. #4 appears to get stuck in ICall_abort().

    So it seems like a hardware issue to me, but I'm not sure what part of my device could be causing it.

    Thanks,

    Adam

  • Hi Adam,

    Did you follow the design guide when you were building your board? Also please make sure your 48 MHz XTAL is one that we recommend or has similar parameters.  I'd recommend looking at the doc to see if you're violating any of the recommendations we set out. You can also post your schematic/layout here and I'll see if anything stands out.  

  • Yeah, I followed the design guide. I've now switched to the internal RC clock and set up the calibrations through the syscfg file. I think the external clock was not working because of what I mentioned in my previous post.

    Here are the links for my schematic and layout:

    Schematic:

    https://drive.google.com/file/d/16wDA3QglrBo9DZptlbIIsBIVQy35ZV_0/view?usp=sharing

    Layout:

    https://drive.google.com/file/d/1zYZhgQbGzf89aNenTp36gEztYnP4WcE3/view?usp=sharing

    I appreciate you taking a look at it, thanks!

    Adam

  • Hi Adam,

    Is it possible that the 48 MHz crystal is still being used to source the system clock? I do notice that you're using 30 pF caps attached to it.That's the only area I see where your design differs greatly from my expectation. You could verify that you're not using the crystal clock by removing it on your LP and seeing if it still operates as expected. (You will need it for accurate bluetooth timing though). I also see that you don't have a 32 kHz crystal attached, but I assume that's because you're using the crystal-less operation function.

    None of the crystals we recommend from the crystal recommendation document require 30 pF load capacitors, so either the crystal you're using isn't one we recommend, or the load cap values are incorrect. If you're unable to source any of the crystals we recommend, I'd recommend picking one with similar characteristics (7-12 pF of load capacitance, +/-10 ppm tolerance, 30-40 Max ESR...etc).

    Best,

    Nate

  • Hi Nate,

    I can look at the register OSC_DIG_MAP1 : STAT0 and verify that the RC clock is chosen for both 32 KHz and 48 MHz. Also, my UART baud rate issue was solved by switching to the RC clock. So I think that the external clock is not being used. But you are saying that in order for the Bluetooth to work at all, I need a working external clock? For example, should I still be able to advertise correctly with the RC clocks?

    The crystal I'm using is not one you recommend. I originally didn't think it would be an issue, but I'm sure I can source one that you do recommend. At this point I was just hoping to get things working with the internal RC oscillators.

    Thanks,

    Adam

  • Hi Adam,

    For comparison try doing the same using the Launchpad and see if you encounter the same issue.

    Also, I recommend you use Simple Peripheral as base for your project.

    -kel

  • Hi Adam,

    Yes that's our recommendation. Bluetooth has strict timing requirements, which require the 48 MHz crystal oscillator in order to meet. While I'm not sure whether you'd see this bug in the advertising stage or later in the Bluetooth protocol, I know that you will have issues if you use the wrong crystal. I'd also recommend reviewing the document's recommended 32 kHz crystals, as this E2E post had a similar issue because their 32 kHz crystal was off.

    Best

    Nate

  • Hi Nate,

    Thanks for the help, using a correct 48 MHz crystal ended up fixing it. I can now get Simple Peripheral to run on the board. Project Zero (and thus my edited version) does not work, and I think it is because the internal 32 kHz oscillator is not calibrated correctly for Project Zero.

    Looking at the "Using 32-kHz Crystal-Less Mode" in the User's Guide, it specifies the file ccfg_app_ble.c, which from what I found online was replaced with ti_devices_config in an updated SDK. I can see ti_devices_config generated by Simple Peripheral, but not Project Zero, as this explains. Do you know if there is a way to change the configuration (maybe in the syscfg file) in order to get the ti_devices_config file to generate for Project Zero as well? I am doing all the other steps required for calibrating the LF_RCOSC.

    Thanks,

    Adam