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.

Task cannot be created in the USB example for Tiva EK-TM4C1294xl

Other Parts Discussed in Thread: EK-TM4C1294XL, SYSBIOS

Hi,

 I am having a peculiar problem. I am using the USB serial example program for the Tiva EK-TM4C1294xl. Specifically I have created a CCS RTOS project and added USBCDCD.c and USBCDCD.h.  I have a uart read task which reads from the UART. Now I want to create a new task to write it to USB. The problem is I cannot create this task. I had problems before of not able to create tasks. I had adjusted heap and stack sizes randomly. What parameter effect the running of the task and task creation?

Initially when I was creating uart_read_task in the main() function it used to crash(task does not get created). I had moved the uart configuration settings code to a separate function and all started working again. Hope this is a hint for something. Also I am creating the tasks dynamically.

What seems to be wrong?

Thanks,

Gautam

  • If I set the Program.stacksize to 768 everything works fine. If I change the stack size to 1024 whenever I plug in the USB cable I get the following error.

    ti.sysbios.family.arm.m3.Hwi: line 1087: E_hardFault: FORCED
    ti.sysbios.family.arm.m3.Hwi: line 1164: E_busFault: IMPRECISERR: Delayed Bus Fault, exact addr unknown, address: e000ed38
    Exception occurred in ISR thread at PC = 0x000087de.
    Core 0: Exception occurred in ThreadType_Hwi.
    Hwi name: {unknown-instance-name}, handle: 0x20000bb8.
    Hwi stack base: 0x200031e8.
    Hwi stack size: 0x400.
    R0 = 0x00000000  R8  = 0x00000000
    R1 = 0x00000041  R9  = 0x0000d768
    R2 = 0x00000001  R10 = 0x0000d760
    R3 = 0x200034e8  R11 = 0x0000d764
    R4 = 0x20002f0c  R12 = 0x00000000
    R5 = 0xffffffff  SP(R13) = 0x200034d8
    R6 = 0x00000001  LR(R14) = 0x00005ffb
    R7 = 0xffffffff  PC(R15) = 0x000087de
    PSR = 0x6100503a
    ICSR = 0x00423003
    MMFSR = 0x00
    BFSR = 0x04
    UFSR = 0x0000
    HFSR = 0x40000000
    DFSR = 0x0000000a
    MMAR = 0xe000ed34
    BFAR = 0xe000ed38
    AFSR = 0x00000000
    Terminating execution...
    ti.sysbios.family.arm.m3.Hwi: line 1087: E_hardFault: FORCED
    ti.sysbios.family.arm.m3.Hwi: line 1199: E_usageFault: INVSTATE: Invalid EPSR and instruction combination
    ti.sysbios.family.arm.m3.Hwi: line 1164: E_busFault: IMPRECISERR: Delayed Bus Fault, exact addr unknown, address: e000ed38
    Exception occurred in ISR thread at PC = 0x0000d760.
    Core 0: Exception occurred in ThreadType_Main.
    Main name: main(), handle: 0x0.
    Main stack base: 0x200031e8.
    Main stack size: 0x400.
    R0 = 0x20002f0c  R8  = 0x00000000
    R1 = 0xffffffff  R9  = 0x0000d768
    R2 = 0x00000001  R10 = 0x0000d760
    R3 = 0xffffffff  R11 = 0x0000d764
    R4 = 0x20002f0c  R12 = 0x00000000
    R5 = 0xffffffff  SP(R13) = 0x200034b8
    R6 = 0x00000001  LR(R14) = 0x0000d768
    R7 = 0xffffffff  PC(R15) = 0x0000d760
    PSR = 0x0000d764
    ICSR = 0x00423003
    MMFSR = 0x00
    BFSR = 0x04
    UFSR = 0x0002
    HFSR = 0x40000000
    DFSR = 0x0000000b
    MMAR = 0xe000ed34
    BFAR = 0xe000ed38
    AFSR = 0x00000000
    Terminating execution...
    

  • Increasing the heap size helped in task creation crash but the imprecise error still remains.
  • Hi Gautam,

    Did you start modifying a USB example? Did you initialize the USB peripheral in main? Are the following being called in main:

    Board_initUSB(Board_USBDEVICE);

    USBCDCD_init();

    Regards,
    -- Emmanuel
  • Yes I started by modifying usbserial example.

    Yes I have called USBCDCD_init() and Board_initUSB(Board_USBDEVICE) in the main.
  • I have some code which you can use to reproduce at your end to get the crash.

    You will get the following crash when your run it:

    ti.sysbios.family.arm.m3.Hwi: line 1087: E_hardFault: FORCED
    ti.sysbios.family.arm.m3.Hwi: line 1164: E_busFault: IMPRECISERR: Delayed Bus Fault, exact addr unknown, address: e000ed38
    Exception occurred in ISR thread at PC = 0x000099f6.
    Core 0: Exception occurred in ThreadType_Hwi.
    Hwi name: {unknown-instance-name}, handle: 0x20000bb8.
    Hwi stack base: 0x20002cb0.
    Hwi stack size: 0x800.
    R0 = 0x00000000  R8  = 0x00000000
    R1 = 0x00000041  R9  = 0xffffffff
    R2 = 0x00000001  R10 = 0xffffffff
    R3 = 0x200033b0  R11 = 0xffffffff
    R4 = 0x2000390c  R12 = 0x20003418
    R5 = 0xffffffff  SP(R13) = 0x200033a0
    R6 = 0x00000001  LR(R14) = 0x00006b01
    R7 = 0xffffffff  PC(R15) = 0x000099f6
    PSR = 0x6100503a
    ICSR = 0x00423003
    MMFSR = 0x00
    BFSR = 0x04
    UFSR = 0x0000
    HFSR = 0x40000000
    DFSR = 0x0000000a
    MMAR = 0xe000ed34
    BFAR = 0xe000ed38
    AFSR = 0x00000000
    Terminating execution...

    After reading through the debugging howto I find that PSR shows as 3A which is 58 which is USB_MAC interrupt vector. Also going through the memory at the place where the PC is printed I find it is  USBEndpointDataGet() function. I don't have an idea of how to debug these drivers.
    Any help would be great.

    2860.usb_crash_test.tar.gz

  • Hi Gautam,

    Sorry for the delayed response.

    I downloaded and ran your code.  However, I could not reproduce the error you mentioned above.  Additionally, I un-commented the usb task and reran without problems (screen shots below).

    It is good to keep Task & Hwi stacks large during development but 2048 is pretty large for the Hwi stack; looking at ROV it looks like it can be reduce to 1k:

    The stack for the USB task is pretty tight and should be increase a few more bytes.

    Regards,

    -- Emmanuel

  • Hi Emmanuel,

    Thanks for the response. I am using CCSv6 on Linux. ( https://www.ti.com/licreg/docs/swlicexportcontrol.tsp?form_type=2&prod_no=CCS6.1.0.00104_linux.tar.gz&ref_url=http://software-dl.ti.com/ccs/esd/CCSv6/CCS_6_1_0/ ) evaluation license.

     

    Could you please replicate in the above setup and let me know. I am able to recreate this crash on two different development boards.

     

    Also by looking at the dump is is possible for you to find out what has happened?

     

    Thanks,

    Gautam.

     

     

  • I am attaching the output file and the linker map file. We should be getting the same generated output file if all the configs are the same correct?

    8475.usb_crash_test.output.zip

  • Hi Emmanuel,

    Could you please follow up on this problem.

    -Gautam.
  • Can you tell me where you installed the TI USB serial port driver?
  • Hi Gautam,

    I am really sorry for losing track of this thread.  

    I was able to reproduce your setup.  I took my version of your application and ran in on linux.  I was able to get both the UART and USB working correctly (See image below: ACM4 is the UART, ACM5 is the USB).

    Here is the version of your project I have been able to get working: 7230.usb_test.zip

    Afterwards, I tried to run the .out you provided, I was able to get the UART port working but not the USB (saw the same outcome on windows and linux).  Please compare your code to the one I posted above (which worked on linux).  Can you get the project above to work on linux & windows as I have?  Have you updated your code recently? Any immediate differences between what I posted and your source?  

    Can you tell me where you installed the TI USB serial port driver?

    Windows drivers can be found in <tirtos install directory>\products\TivaWare_C_Series-2.1.0.12573c\windows_drivers.

    Linux does not require additional drivers.

    Regards,

    -- Emmanuel

  • Emmanuel,

    Please use the tools that I am using to recreate it and also specify on what version of the tools you are testing. You have to use latest CCSv6 on Linux to recreate this bug. There is no point in testing when the tools we are using is different.

    Is there anything to consider when using the windows drivers for Windows 8.1 like driver signing etc?

    Thanks,
    Gautam.

  • My code works on CCSv5 on Windows. I have reinstalled CCSv6 on Linux. Let me see if it will work there now.
  • Hi Gautam,

    Your previous post mentioned you were using CCS 6.1.0.00104 and from the project you sent me I noticed you were using TI-RTOS for TivaC 2.12.1.33 (uses XDCTools 3.31.0.24_core).  I am using these versions in Windows and Linux.  Additionally, I am using the TI ARM 5.2.3 ARM compiler (I also tested with 5.2.4 and it worked).   Can you confirm these are the versions you are using as well?  

    As you can see below, I only un-commented the USB portion of your code.  No other modifications have been made.

    Were you able to run the executable I posted?

    Regards,

    -- Emmanuel

  • With unmodified code you should be getting the same binary ( .out file) as mine. Is there any difference between my and your binary files? You can check the hash values of both of them to verify.

    I will test this code in Linux and verify.

  • Emmanuel,

    I finally reinstalled everything in Linux and thankfully got things running. I am able to see the messages.

    Now I have a new problem. I started adding code reading through UART and sending via USB and I start seeing problems i.e. sometimes it works and I see message sent out of USB but sometimes I don't see anything and even my UART does not work.

    I paused and saw ROV and I see Hwi Overrun. Should I increase the stack size or something?

    System (Hwi and Swi) stack size : 768
    Heap size: 4096

    Currently my stack size for 2 tasks (read from uart task and write to usb task) is 512 each. The task was created in the program.

    -Gautam.
  • And increasing the Program.stack to 0x1000 throws the following error again:

    ti.sysbios.family.arm.m3.Hwi: line 1087: E_hardFault: FORCED
    ti.sysbios.family.arm.m3.Hwi: line 1164: E_busFault: IMPRECISERR: Delayed Bus Fault, exact addr unknown, address: e000ed38
    Exception occurred in ISR thread at PC = 0x00009a8a.
    Core 0: Exception occurred in ThreadType_Hwi.
    Hwi name: {unknown-instance-name}, handle: 0x20000498.
    Hwi stack base: 0x20003db0.
    Hwi stack size: 0x1000.
    R0 = 0x00000000  R8  = 0x00000000
    R1 = 0x00000041  R9  = 0x0000f830
    R2 = 0x00000001  R10 = 0x0000f828
    R3 = 0x20004cb0  R11 = 0x0000f82c
    R4 = 0x2000520c  R12 = 0x00000000
    R5 = 0xffffffff  SP(R13) = 0x20004ca0
    R6 = 0x00000001  LR(R14) = 0x00006dc3
    R7 = 0xffffffff  PC(R15) = 0x00009a8a
    PSR = 0x6100503a
    ICSR = 0x00423003
    MMFSR = 0x00
    BFSR = 0x04
    UFSR = 0x0000
    HFSR = 0x40000000
    DFSR = 0x0000000a
    MMAR = 0xe000ed34
    BFAR = 0xe000ed38
    AFSR = 0x00000000
    Terminating execution...

  • Attaching snapshot of the hwi overrun.

  • I connected the USB end to a Windows 8.1 PC and it works fine there. So it looks like during enumeration in Linux the USBEndpointGetData seems to cause a crash.

    Would you be able to find out why?
  • Gautam, 

    First lets try to track down the source of the exception.  Once you get the register dump, copy the PC, LR & SP values printed into the Registers window in CCS.  You should be able to see what was executing when the exception was triggered.  You can then set a breakpoint before and step through the code to track the culprit.

    Secondly, can you post the code being executed in the ISR below?  Are you making UART/USB driver calls in the Hwi ISR?

    Regards,

    -- Emmanuel

  • Emmanuel,


    The exception is in USBEndpointDataGet.


    Attaching the screen shot which shows ROV pointing to the exception.

    I don't have any code written in the ISR. I am not doing any UART/USB driver calls in the Hwi ISR.

    The above problem happens if I connect my USB cable to the USB port. This does not seem to happen on windows but happens on linux. This is the reason as shown in the snapshot it happens at USBEndpointDataGet.

    Thanks,

    Gautam.

  • Sorry to bump this ancient thread, but it's relevant to me. Did you guys ever figure out why you get the "IMPRECISERR" when connecting the end-point to linux? I am running into this problem too. When I connect to linux I get the same crash. Connecting to mac OSX works just fine.

    Thanks,

    -Lance

  • Hi Lance,

    Apologies for not updating the thread. The error is caused due a bug in the TI USB stack not able to handle some USB messages. In Linux when you connect the CDC ACM Modemmanager service gets started and tries to communicate with the board. The USB not able to handle this enumeration messages crashes. Therefore first try disabling or uninstalling modemmanager. This should solve the problem.

    Thanks,

    Gautam.