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.

Dynamically enabling and disabling HWI's

Other Parts Discussed in Thread: SYSBIOS

Hi, I'm trying to set up a tcp socket first before I want to sample my ADC using uDMA to transfer the data to a buffer. The tcp socket code is running as a task with a priority of 1 and the HWI with a priority of 1. I call Hwi_disable() before BIOS_start() but it didn't stop the Hwi from running. I tried to call Hwi_disable() at the start of my Hwi interrupt handler but it crashed the program with this:

FSR = 0x0008
HFSR = 0x40000000
DFSR = 0x0000000b
MMAR = 0xe000ed34
BFAR = 0xe000ed38
AFSR = 0x00000000

Is there anyway I can dynamically change the way the HWI runs and tcp task runs. I basically want to be able to set up the tcp socket, once that's done, I want to sample the ADC and store them and then block the HWI and try to send the samples in the tcp task handler? As an aside, I'm using a TM4C1294XL. 

  • Lee,

    BIOS_start() will enable interrupt processing as part of the kernel startup process.  You can’t stop that.  Also, interrupts must not be explicitly enabled by the application before calling BIOS_start(), because all the kernel modules won’t have been fully initialized yet.

    Can you clarify when/where you are initiating ADC/uDMA sampling?  Is this something that can be moved, until the point in your application that you want to enable it?

    Thanks,
    Scott

  • I'm initialising the ADC and udma before BIOS_start() like where every other initialisation. I tried moving the initialisation to the point where I need it enabled but how would I disable it afterwards?

    The way I need the program to flow is have the tcptask run so that it will set up the socket and connect to the socket. Once the connection has been established I need the tcp task to suspend and let the interrupt process begin to sample. Once my sampling is done, the interrupt needs to be suspended and the tcp will send the samples off.
    More simply (having each thread run separately) :
    tcp task -> adc Hwi -> tcp task -> adc Hwi -> etc..

  • Is there a way to dynamically change the task and hwi priority?
  • Sorry for the delay, I’ve been out of the office.

    Lee Gats said:

    I'm initialising the ADC and udma before BIOS_start() like where every other initialisation. I tried moving the initialisation to the point where I need it enabled but how would I disable it afterwards?


    You'll need to write to the ADC peripheral to stop it from doing any further sampling.  And, you can use Hwi_disableInterrupt() for the ADC interrupt number, to explicitly disable it from being able to interrupt the CPU.

    Lee Gats said:

    Is there a way to dynamically change the task and hwi priority?


    You can dynamically change Task priorities using Task_setPri().  This and other APIs are described in the documentation included in the product installation.  Open Bios_APIs.html (for example: C:\ti\tirtos_tivac_2_14_04_31\products\bios_6_42_03_35\docs\Bios_APIs.html), and navigate to the module: ti.sysbios.knl.Task

    You can dynamically change Hwi priorities using Hwi_setPriority().  See the module: ti.sysbios.family.arm.m3.Hwi   

    There is some additional description of Hwi priorities and masking on this wiki page: processors.wiki.ti.com/.../BIOS_for_Stellaris_Devices

    You cannot dynamically change the relative priorities between Tasks and Hwis.  A ready and enabled Hwi will always preempt a running Task.