Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Phil

Pages: [1] 2
ATMELTM AT91SAM7X and AVR32 / UC3A Device Support
« on: November 03, 2021, 12:43:54 AM »

What is the status of support for AVR32 UC3A devices these days?  I have access to a processor, AT32UC3A0512-ALUT, which I am considering using to replace some harder to find NXP Kinetis processors.  I am considering porting the uTasker code over to this AT32 processor.  The uTasker docs say these chips have "medium support".  Not sure what that means.

Can you explain?



USB / USB on Windows 10
« on: July 09, 2021, 01:18:06 AM »

I obviously have a Windows 10 driver problem with my USB serial interface to my MK64 processor. I am wondering if you have experienced anything like this before.

When I connect my MK64 board via USB to a certain Windows 10 PC, the USB port is unreliable at best. I hear the Window's Chime when the MK64 is connected and the Device Manager shows the COM3 port connected. However, neither TeraTerm or Putty is able to connect for 10-15 seconds. Once connected, the menu interface seems to work just fine for a while then it hangs. The MK64 is not locked up or resetting. But, at this point, the port is unusable. Sometimes unplugging and plugging back in the cable from the PC to the MK64 frees up the port to work again.

I have other Windows 10 machines that work perfectly with the same MK64 device and same cable.

I have unloaded the Windows driver for the USB device and restarted the machine. Problem persists. This PC is a Dell Insperion or something like that built in 2018. A little old but still working well in all other aspects besides USB serial. No problems printing via USB. No problems with keyboard or mouse activity.



NXPTM M522XX, KINETIS and i.MX RT / K64 ADC Results
« on: May 03, 2021, 04:52:19 AM »

I have been studying the uTasker ADC documentation, the forum, and ADC_Timers.c for quite some time. I think I understand the process fairly well. However, I am still unable to confidently get resultant data back from the ADC module as I would like.

I am trying to read the voltage on a variable potentiometer. 0-3.3V. Connected to SE14. I know the voltages are changing at the port. I am able to generate the interrupt depending upon the voltage. However, I am unable to see the actual line voltage as read from the ADC module.

Can you explain why I am unable to obtain a valid read from SE14 using the ADC module?

Step 1 - Initialization of ADC configuration:

    ADC_SETUP adc_setup;                        // ADC Setup Structure for Headphone Rotary Dial (POT)
    ADC_RESULTS adc_results;                     // ADC Raw Voltage Level of Headphone Rotary Dial (POT)
    #define AD_DA_BUFFER_LENGTH    (8 * 1024)                        // DMA buffer for 1s at 8k bytes/s
    static signed short sADC_buffer[AD_DA_BUFFER_LENGTH] = {0};      // 16 bit samples

    // ADC Setup for Headphone Rotary Dial (POT) Calibration
    adc_setup.int_type = ADC_INTERRUPT;                                  // identifier when configuring
    adc_setup.int_handler = 0;                                   // adc INT handler routine
    adc_setup.dma_int_priority = 3;                                      // priority of DMA interrupt the user wants to set
    adc_setup.dma_int_handler = 0;                                       // no interrupt so that free-running circular buffer is used (when ADC_FULL_BUFFER_DMA_AUTO_REPEAT is not defined)
    adc_setup.ucDmaChannel = 6;
    adc_setup.ptrADC_Buffer = sADC_buffer;                               // ADC sample buffer to be used
    adc_setup.ulADC_buffer_length = sizeof(sADC_buffer);                 // physical length of the buffer
    adc_setup.usDmaTriggerSource = 0;                                    // default trigger is the ADC conversion completion of the channel in question
    adc_setup.pga_gain = PGA_GAIN_OFF;                                   // {13} PGA gain can be specified for certain inputs
    adc_setup.int_priority = PRIORITY_ADC;                               // ADC interrupt priority
    adc_setup.int_adc_controller = 1;                                    // ADC controller 1
    adc_setup.int_adc_int_type = (ADC_SINGLE_SHOT_TRIGGER_INT);          // interrupt type
    adc_setup.int_adc_offset = 0;                                        // no offset
    adc_setup.int_adc_bit = ADC_SE14_SINGLE;                             // SE14 Pin
    adc_setup.int_adc_sample = (ADC_SAMPLE_LONG_PLUS_12 | ADC_SAMPLE_AVERAGING_32); // additional sampling clocks
    adc_setup.int_adc_result = 0;                                        // no result is requested at this stage
    fnConfigureInterrupt((void *)&adc_setup);   // Perform Configure and Calibration of ADC Channel

Step 2 - Setup the interrupt for the ADC:  (just triggering on any voltage below 1.0V, which seems to trigger properly)

    adc_setup.int_adc_controller = 1;                                    // ADC controller 1
    adc_setup.int_adc_bit = ADC_SE14_SINGLE;                             
    adc_setup.int_adc_int_type = (ADC_LOW_LIMIT_INT);                    // interrupt type (trigger only when lower than the defined level)
    adc_setup.int_low_level_trigger = (unsigned short)(ADC_VOLT * 1.0);  // the low level trigger threshold represented as input voltage (note: setting low threshold higher than the high threshold causes a trigger inside the range rather than outside of it)
    adc_setup.int_handler = GetRotaryPos;                                   // handling function
    adc_setup.int_adc_result = &adc_results;                               // I want to know the current value
    adc_setup.int_adc_mode = (ADC_SELECT_INPUTS_A | ADC_CLOCK_BUS_DIV_2 | ADC_CLOCK_DIVIDE_8 | ADC_SAMPLE_ACTIVATE_LONG | ADC_CONFIGURE_ADC | ADC_REFERENCE_VREF | ADC_CONFIGURE_CHANNEL | ADC_SINGLE_ENDED_INPUT | ADC_SINGLE_SHOT_MODE | ADC_12_BIT_MODE | ADC_SW_TRIGGERED); // note that the first configuration should calibrate the ADC - single shot with interrupt on completion {12}
    fnConfigureInterrupt((void *)&adc_setup);                            // start operation now

Step 3 - Evaluate the results of the analog line and setup the ADC for subsequent interrupts:

void GetRotaryPos(void)            // Service Routine for ADC Rotary Dial Read
    signed short rotary_raw;                     // value of SE14 pin voltage

    // ucADC_status[0] and [1] are always not valid (0)
    if (adc_results.ucADC_status[0] == ADC_RESULT_VALID)           // if the conversion is ready
        rotary_raw = adc_results.sADC_value[0];
       rotary_raw = 0;

    // Relaunch ADC Interrupt for Headphone Rotary Dial (POT) - Get Value of Rotary Dial Position (voltage level)
    // ...


Result:  rotary_raw is always 0.  Goal: rotary_raw should be between 0.0 and 3.3.  In this interrupt example above, rotary_raw should be between 0.0 and 1.0.

Any suggestions?





This K64 has a 25MHz crystal connected at XTAL0/EXTAL0.  I can't seem to get past the "loop until.." in kinetis_K_CLOCK.h:

    while ((MCG_S & MCG_S_IREFST) != 0) {                                // loop until the FLL source is no longer the internal reference clock
            #if defined _WINDOWS
        MCG_S &= ~MCG_S_IREFST;

Here is what my app_hw_kinetis.h looks like:

//      #define OSC_LOW_GAIN_MODE                                            // oscillator without feedback resistor or load capacitors so use low gain mode
        #define CRYSTAL_FREQUENCY    25000000                            // 25 MHz crystal
   #define RUN_FROM_EXTERNAL_CLOCK                                  // run directly from external 25MHz clock
        #define CLOCK_DIV            10                                  // input must be divided to 2MHz..4MHz range (/1 to /24)
        #define CLOCK_MUL            48                                  // the PLL multiplication factor to achieve operating frequency of 120MHz (x24 to x55 possible)
        #define FLEX_CLOCK_DIVIDE    3                                   // 120/3 to give 40MHz
        #define FLASH_CLOCK_DIVIDE   5                                   // 120/5 to give 24MHz
//   #define USB_CLOCK_GENERATED_INTERNALLY                           // use USB clock from internal source rather than external pin - 120MHz is suitable from PLL

Am I doing something wrong here?  I think it should be working but I don't see anywhere uTasker tells the osc block to use the XTAL0 port then enable the clock.



« on: October 27, 2020, 12:49:18 AM »
Mark, et. al,

I am considering the USB Audio interface for a upcoming project.

I am receiving an analog or digital (I2S) SAI stream from a microphone source. I'd like to use the NXP MK64 processor to output the microphone source as a USB Audio Device so a Windows-based PC can recognize and use the microphone audio source. However, it is important that the USB is seen by Windows as a USB Audio Class Device so as to be usable in Skype or other soft codecs.

I can provide the audio in analog or digital format. I would think it would be better to keep this in the digital domain (I2S)?

I am thinking about using a MK66 with (2) USB ports, utilizing one for USB Audio and the other for firmware updates, CDC, etc.  Any concerns about this idea?

Thank you for your opinion.


NXPTM M522XX, KINETIS and i.MX RT / KL27 ROM Bootloader with KDS
« on: June 16, 2020, 12:00:23 AM »
Mark, et al,

I am writing firmware for a KL27 with embedded ROM bootloader using KDS.

When writing directly directly into the KL27 using my SEGGER JLINK I using the build configuration uTaskerV1.4_FLASH. Everything works fine.

When using the ROM bootloader, I would think the build configuration changes to uTaskerV1.4_BM_FLASH. When I try to use the ROM bootloader with the newly created BM_FLASH image everything seems to load fine but the KL27 goes into a watchdog-type reset loop upon startup.

Again, when I load using the uTasker1.4_FLASH build configuration using my SEGGER JLINK debugger everything works fine.

Any ideas?




Having troubles with a Windows 10 64-bit user that can't seem to see my uTasker/K64F USB Serial port. When connecting the our uTasker system, the user sees a unknown USB device error message. Going to the Device Manager, Ports (COM & LPT) there is no new COM ports.

Per,, and the USB Users Guide, I had him install "uTaskerFreescaleMultiVirtualCOM1-6_64bit.inf" but nothing really changed.

I have had some minor success by unloading the USB Composite Device from the Universal Serial Bus controllers section of the Device Manager. When I reconnect the USB between his PC and my system it loads up with an error about an unknown USB device but it then continues with a recognition of the USB device (I know this because it says my product name "Avolana"). However, it still will not load the USB Serial Port drivers.

Interestingly, I used the bootloader and this same device and I was able to drag and drop a new version of the firmware so I know it is seeing the USB-MSD drivers correctly.

This board connects to other Windows 10 PCs without ANY troubles.

Any ideas what is going on?  Suggestions?

Thank you.


NXPTM M522XX, KINETIS and i.MX RT / Change Baud Rate on Serial Port
« on: February 11, 2020, 01:22:21 AM »

How do we change serial port settings on an open port?  I need to change the baud rate (and possibly other settings) on an open serial port.  I have used the serial port feature for years now. This is the first time I've needed to change a port setting in real time.

Thank you.


NXPTM M522XX, KINETIS and i.MX RT / strtok
« on: February 06, 2019, 12:09:24 AM »

Had something happen today that was rather strange.

I was reusing some code developed on a K64 and using this with a KL27. Interestingly, I ran into a bunch of problems related to the handling of strings. Simple things like defining an array of characters predefined to a 0 or using a strtok string function.  I know we had issues with strcpy and these types of functions but are these issues related?

Finest regards,


NXPTM M522XX, KINETIS and i.MX RT / Timer Interrupt Overrun
« on: September 18, 2018, 11:27:09 PM »

Here is a sample timer interrupt process that I am running:

   static TIMER_INTERRUPT_SETUP timer_setup = {0}; // interrupt configuration parameters

   timer_setup.int_type = TIMER_INTERRUPT;
   timer_setup.int_priority = PRIORITY_TIMERS;
   timer_setup.int_handler = IR_Receiver;
   timer_setup.timer_reference = 2; // timer channel 2
   timer_setup.timer_mode = (TIMER_PERIODIC | TIMER_US_VALUE); // single shot us timer
   timer_setup.timer_value = 281; // (562.5/2) // µs delay
//   timer_setup.timer_value = 1000;
   fnConfigureInterrupt((void *)&timer_setup); // enter interrupt and start timer

The function, IR_Receiver(), gets executed once every 281 us.  The problem is that it causes a hardware reset on my MK64 MCU.  If I change the timer_value to 1000 us, there is no lockup and the routine runs from beginning to end. It doesn't happen quick enough to get us the valid info we need but it works nonetheless.

I see examples of PIT timers and other timers with 100 us cycle times. I wouldn't think this would be a problem. But, my MCU resets.

Can you explain what is happening?



NXPTM M522XX, KINETIS and i.MX RT / Interrupt Control
« on: September 18, 2018, 06:12:01 PM »
Mark, et al,

I am trying to read an incoming IR stream from a remote control.  From the IR receiver, I have an active-low GPIO inbound signal. All pretty straight-forward.

I was planning to create an initial interrupt upon the first active low pulse. After that, I create a periodic 1 ms timer interrupt to sample the inbound stream 68 times (68 ms total).

In this plan, I need to temporarily disable the initial interrupt so it doesn't keep triggering while I am reading the 1 ms pulses.

Just prior to restarting the initial interrupt, I need to clear the interrupt queue, if any.

It would be nice if I could SINGLE_SHOT a standard interrupt. Is that possible?

What do you recommend?

Thank you in advance.


NXPTM M522XX, KINETIS and i.MX RT / Watchdog Trigger
« on: May 25, 2018, 12:35:41 AM »
Is there a configuration setting for the watchdog timer that can be adjusted?

It looks like the watchdog is set to about 1 second.

I'd like to change that to 2 seconds or possibly 3 before a watchdog reset occurs.

I know one can retrigger the watchdog periodically but I am using a library function that prevents me from initiating a retrigger within another person's code.

Another option might be to disable the watchdog while the function is performed then re-enable the watchdog afterward. This would be good to know as well.

Thank you.


« on: May 15, 2018, 02:39:16 AM »

I am trying to do a simple ADC port read and been trying to follow code from the forum to no avail.

Code: [Select]
static void fnInitADC(void)
    ADC_SETUP adc_setup;                                                 // interrupt configuration parameters
    adc_setup.int_type = ADC_INTERRUPT;                                  // identifier when configuring
    adc_setup.int_adc_controller = 0;                                    // ADC controller
    adc_setup.int_adc_bit = ADC_SE15_SINGLE; // pressure sensor location
    adc_setup.int_adc_mode = (ADC_CONFIGURE_ADC | ADC_CONFIGURE_CHANNEL | ADC_SINGLE_ENDED_INPUT | ADC_LOOP_MODE ); // single ended configuration in loop mode
    adc_setup.int_adc_int_type = 0;                                      // no interrupt
    fnConfigureInterrupt((void *)&adc_setup);                            // configure and start operation

static void fnReadPressure(void)
    int iADC_delay = -1;

    ADC_SETUP adc_setup;                                                 // interrupt configuration parameters
    ADC_RESULTS results;

    adc_setup.int_type = ADC_INTERRUPT;                                  // identifier when configuring
    adc_setup.int_adc_controller = 0;                                    // ADC controller
    adc_setup.int_adc_bit = ADC_SE15_SINGLE; // pressure sensor location
    adc_setup.int_adc_result = &results;
    adc_setup.int_adc_mode = (ADC_READ_ONLY | ADC_GET_RESULT);
    do {
        fnConfigureInterrupt((void *)&adc_setup);                        // get result
    } while (results.ucADC_status[ADC_SE15_SINGLE] == ADC_RESULT_NOT_READY);           // 'poll until the result is ready

    if (results.ucADC_status[ADC_SE15_SINGLE] != ADC_RESULT_NOT_READY) {
        fnDebugMsg("ADC value = ");
        fnDebugHex(results.sADC_value[ADC_SE15_SINGLE], 2);
    else {
        fnDebugMsg("ADC not ready\r\n");

fnInitADC() gets run at initialization.
fnReadPressure() gets run periodically from a task every 3 seconds.

MCU = MK64FX512VLL12
Pin 71 = PTC1 (ADC0_SE15)  (voltage at the pin varies from 0.5 to 2.5 vdc)

I am trying to read "ad hoc". Is a interrupt handler actually required/recommended?

Mark, et al,

I have an application that works great using uTasker. I am not trying to take advantage of the features of the Serial Bootloader so I can upload new firmware via RS232, Ethernet, USB-CDC, or USB-MSD (preferred).

The Serial Bootloader seems to be working well. I am using a switch on my custom PCB that gets it into bootloader mode and my PC opens a USB-MSD folder perfectly.

I have modified the application linker file so that it starts at 32K point per the Serial Bootloader documentation. I have attached that file called "K_512_192_Using_Bootloader.ld".  The application compiles just fine and creates .bin, .hex, and .srec files.

I drag and drop the .bin file into the MSD folder and everything seems go-to-go but the application does not start. Resetting the board does not work either. The bootloader just resets like normal.

When I load the bootloader itself and I run this in debug mode. Pausing shows it within the "irq_default(void)" undefined interrupt routine.  But, as I said before, when I trigger the bootloader switch the bootloader rumps into action and the USB-MSD pops up just fine. However, this might be a clue why things are not working properly.  I have attached the config.h and app_hw_kinetis.h files from the bootloader.

Any ideas or suggestions?



µTasker general / USE_SNTP vs USE_TIME_SERVER
« on: November 11, 2017, 02:02:44 AM »

What is the difference between USE_SNTP and USE_TIME_SERVER?

Each uses different time server IP addresses within the parameter list but both seem to update the local RTC clocks.

My UTC is off by 1 hour. Probably a daylight savings flag somewhere.



Pages: [1] 2