Author Topic: UART channel sharing  (Read 3660 times)

Offline FABRIZIO

  • Newbie
  • *
  • Posts: 5
    • View Profile
UART channel sharing
« on: December 13, 2017, 02:19:24 PM »
Can I use the same UART0 channel both to run the serial bootloader and for other uses in "my application"? I observe that any type of data packet that arrives from the PC to the UART0 after the boot has finished causes the microcontroller to stall ...
Regards
Fabrizio

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: UART channel sharing
« Reply #1 on: December 13, 2017, 06:03:00 PM »
Fabrizio

If you use UART0 for serial loading and subsequently for the application I would not expect that the application has difficulties with the re-use.

Check that when the serial loader jumps to the application that it is executing code to disable used interrupts and the UART, which looks like this in the case of the KE(A) devices:

        #define RESET_PERIPHERALS()SYSTICK_CSR = 0; \
                                   POWER_DOWN(4, (SIM_SCGC4_UART0 | SIM_SCGC4_UART1 | SIM_SCGC4_UART2)); \
                                   IRQ0_31_CER  = 0xffffffff


This powers down the UARTs and disables all interrupt sources which avoids possible spurious interrupts when the application performs its configuration.

The subsequent use of the UART should essentially be similar to from a reset condition (although some UART configuration register may not be identical) but it may depend on the UART driver that you are using whether there could be an issue. Does your application use the uTasker UART driver or other?

Regards

Mark



Offline FABRIZIO

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: UART channel sharing
« Reply #2 on: December 14, 2017, 08:30:27 AM »
I used CodeWarrior's beans (v.10.7) to configure the devices, including the UART0 However I had not set the disabling of the interrupts before jumping to the application. Now it seems fixed, but I'm doing further tests to see if everything is really ok and I'll update you. I take this opportunity to compliment you, you have created a very powerful and flexible project but above all you have a high capacity to enter and understand the projects and problems of others. Thank you very much