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.

TMS320F28027: SCI not working in the main function when booting from FLASH

Part Number: TMS320F28027

Hello,

I have an LCD screen with this controller and am using SCI to communicate with it. In the main function of the code, I write a message to the screen and I also have an ISR that writes to the screen when a button is pressed. When uploading the code to RAM, the message from the main function displays on the screen, and when the button is pressed, the message from the ISR is displayed. However, when I upload the code to and boot from FLASH, the message in the main function does not display, but when I press the button, the message from the ISR is displayed. Can someone explain to me how I can solve this issue? I can provide the code if necessary. 

Thanks,

Jeff

  • Hi

    When it's likely to get simultaneous access to the same resource from different tasks, or foreground task and interrupts, some synchronization like mutexes or disable of interrupts or something is usually required. Doing simple thing like setting GPIO high or low using GPIOSET/CLR/TOGGLE registers is fine from different threads or interrupt, but not doing the same modifying GPIODAT, because interrupt may happen after main task read GPIODAT and before it wrote modified value back to GPIODAT. Communicating over SCI is not simple like GPIO, you must be sending some multibyte commands, right? What happens when in the middle of phrase your button interrupt occurs and inserts it's own message? Will LCD display both message in this case? I doubt it. You should either 1) disable button interrupt in main task before sending to screen, reenable after. This would prevent simultaneous access to LCD. 2) in button interrupt just register button event in some variable, then in main task handle this event sending to LCD. This also will prevent simultaneous access to LCD.
    If you wonder why it worked from RAM, perhaps something was running faster/slower and simultaneous write to LCD just didn't happen.

    Edward
  • Edward,

    I appreciate your response, though I do not believe simultaneous access is the issue: Initially, I have a message that is sent in the main function to the LCD, afterward I enable the interrupt for a push button. Next, after an arbitrary amount of time, I will push the button to enter the ISR and display a different message to the LCD. I am not pressing the button during the message transmission in the main function (which shouldn't work anyway, as I don't enable the interrupt until afterward).

    I believe my problem has something to do with the differences in the way the MCU boots from FLASH versus RAM. It works fine with RAM, every time. Though from FLASH, the message in the main function does not get displayed, but the button press interrupt message does.

    Thanks,
    Jeff
  • Jeff,

    Since your program works properly when booting to RAM, but not when booting to flash, you might need to check your flash linker command file. This may not be a problem with the SCI, but an issue with linking. Please see the following F28027 one-day workshop at:

    processors.wiki.ti.com/.../C2000_Archived_Workshops

    Then compare your flash .cmd file to the Lab 4 "Lab_4.cmd" file. Also, you can compare your RAM .cmd file to the Lab 3 "Lab_2_3.cmd" file as a reference.

    I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken
  • Jeff,

    why don't you just debug why your first message isn't sent? Using scope could you check if it is really sent, perhaps something is wrong with LCD init?

    Booting from RAM your LCD is not powered cycled, perhaps something is kept not reset-default from previous run from RAM. Is BOOTMODE pulled low when you debug after power on? If not, then some code in flash is executed before you click connect in debugger..

    Perhaps some glitch on serial line is noticed by LCD on power up, it could start waiting completion of some command, which doesn't happen until you send next message? Could you send on boot new line or something, which would release the LCD from bad state.

    Edward

  • Jeff,

    It's been a while since we have heard from you last. Therefore, we are assuming you were able to resolve your issue. If this isn’t the case, please reject this resolution or reply to this thread. If this thread locks, please make a new thread describing the current status of your issue. Thank you.

    - Ken