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 - jackking

Pages: [1]
1
I am reading the test drive document for the Serial Loader: https://www.utasker.com/docs/iMX/uTaskerLoader_TestDrive.pdf

the doc mentions:
"recovery via serial “Fall-back” loader when a faulty application or a faulty serial loader is installed"

But the doc doesn't describe how this actually happens.   How does uTaskerBoot know to start the fallback loader instead of the serial loader if the serial loader is corrupted?

I see the fallback loader start if the serial loader is missing completely, but how would this work if the serial loader is present, but corrupted or needs to be updated?

thanks




2
I am trying to completely automate my dev cycle, using command line sdphost to load the flashloader, then blhost to write the uTasker Serial Loader.  This is instead of using MCU Boot Utility.

I can get the SerialLoader written to flash without issues, but I would like to then cause blhost to jump to execution of the SerialLoader.

I tried following this approach: https://community.nxp.com/t5/MCUXpresso-Secure-Provisioning/BLHost-Execute-application-from-NOR/td-p/1546972

It does jump, but the SerialLoader doesn't seem to actually execute correctly, so I must be missing something.

Has anyone tried this with the uTasker SerialLoader?

Here are my commands to try and execute the jump from blhost:
Code: [Select]
../secure_provisioning/blhost -t 5242000 -u 0x15A2,0x0073 -- read-memory 0x60001000 8
Inject command 'read-memory'
Successful response to command 'read-memory'

d1 00 20 41 00 20 00 60

(1/1)100% Completed!
Successful generic response to command 'read-memory'
Response status = 0 (0x0) Success.
Response word 1 = 8 (0x8)
Read 8 of 8 bytes.

Application address:  0x60002000
../secure_provisioning/blhost -t 5242000 -u 0x15A2,0x0073 -- read-memory 0x60002000 8
Inject command 'read-memory'
Successful response to command 'read-memory'

00 c0 2b 20 61 33 00 60

(1/1)100% Completed!
Successful generic response to command 'read-memory'
Response status = 0 (0x0) Success.
Response word 1 = 8 (0x8)
Read 8 of 8 bytes.

Stack pointer:  0x202bc000
Reset vector:  0x60003361
../secure_provisioning/blhost -u 0x15A2,0x0073 -- execute 0x60003361 0 0x202bc000
Inject command 'execute'
Successful generic response to command 'execute'
Response status = 0 (0x0) Success.



3
I am trying to do some extra credit in my SerialLoader and have a test routine that reads ADC inputs, but I'm not having much luck.

I see various other posts about the ADC, I have checked ADC_Timers.h for example config as well as the pdf on ADC usage, but I still get no reading.

I have two inputs on the i.MX RT (1062), GPIO_AD_B1_04 and GPIO_AD_B1_05. which have the analog voltage coming in.  Using the NXP MCUXpresso SDK, I am able to set up ADC_ETC and the ADC channels 1 and 2 with chaining to successfully read both inputs after a chained conversion is triggered by a PIT.

Using uTasker, I don't really have a clue where to start...

I don't know how to understand the mapping of the actual pins applies to the ADC_SETUP.  I assume that the int_adc_bit should define this using one of the ADC_SE defines in iMX.h:
Code: [Select]
#define ADC_SE0_SINGLE          0
#define ADC_SE1_SINGLE          1
#define ADC_SE2_SINGLE          2
#define ADC_SE3_SINGLE          3
#define ADC_SE4_SINGLE          4
#define ADC_SE5_SINGLE          5
#define ADC_SE6_SINGLE          6
#define ADC_SE7_SINGLE          7
#define ADC_SE8_SINGLE          8
#define ADC_SE9_SINGLE          9
#define ADC_SE10_SINGLE         10
#define ADC_SE11_SINGLE         11
#define ADC_SE12_SINGLE         12
#define ADC_SE13_SINGLE         13
#define ADC_SE14_SINGLE         14
#define ADC_SE15_SINGLE         15
#define ADC_ETC_SINGLE          16

But it also mentions these should map to inputs 0...31 (?). and I see ADC_ETC as well, but I don't see how to set that up.

I also see some of the examples seem to set the int_handler multiple times before setting the actual interrupt, wouldn't this just overwrite the previous value and have no effect?
For example in the ADC pdf it has:
Code: [Select]
ADC_SETUP adc_setup; // interrupt configuration parameters
adc_setup.int_type = ADC_INTERRUPT; // identifier when configuring
adc_setup.pga_gain = PGA_GAIN_OFF; // PGA gain can be specified for certain inputs
adc_setup.int_handler = fnRangeInterrupt; // handling function
adc_setup.int_priority = PRIORITY_ADC; // ADC interrupt priority
adc_setup.int_adc_controller = 1; // ADC controller 1
adc_setup.int_adc_offset = 0; // no offset
adc_setup.int_adc_mode = (ADC_CALIBRATE | 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 | ADC_SINGLE_SHOT_MODE | ADC_12_BIT_MODE |
ADC_SW_TRIGGERED); // calibrate the ADC - single shot with interrupt on completion
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
adc_setup.int_adc_bit = ADC_DM1_SINGLE; // ADC DM1 single-ended
adc_setup.int_adc_bit_b = ADC_DISABLED; // channel B only valid in HW triggered mode
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.3);
// the low level trigger threshold represented as input voltage
adc_setup.int_handler = adc_ready_1; // handling function

Which sets the int_handler twice, once to fnRangeInterrupt and then to adc_ready_1 at the end. How is this supposed to work?

Here is the code I have been trying to get working as a test on the iMX:

Code: [Select]
ADC_RESULTS  samples;

void fnADCresult()
{
// get the sample
fnDebugMsg("ADC SAMPLE: ");
fnDebugHex((unsigned short) samples.sADC_value[0], (sizeof(unsigned short) | WITH_LEADIN | WITH_CR_LF));

        // set up for the next sample (after we get this working once)
}

void fnInitializePots(void)
{
fnDebugMsg("INIT ADC\r\n");

    // set the ADC input pins?
    _CONFIG_PORT_INPUT(6, PIN_GPIO_AD_B1_04_GPIO6_IO20, (0));
    _CONFIG_PORT_INPUT(6, PIN_GPIO_AD_B1_05_GPIO6_IO21, (0));

    // now we need to set up the ADC to read the pot values
    ADC_SETUP adc_setup; // interrupt configuration parameters
    adc_setup.int_type = ADC_INTERRUPT; // identifier when configuring
    adc_setup.pga_gain = PGA_GAIN_OFF; // PGA gain can be specified for certain inputs
    adc_setup.int_priority = PRIORITY_ADC; // ADC interrupt priority
    adc_setup.int_adc_controller = iMX_ADC_1;                            // first i.MX RT ADC
    adc_setup.int_handler = 0; // handling function, removed for now
    adc_setup.int_adc_bit = ADC_SE10_SINGLE;                              // which pin is this?
    adc_setup.int_adc_offset = 0; // no offset
    adc_setup.int_adc_mode = (ADC_CALIBRATE | 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}
    adc_setup.int_adc_sample = (ADC_SAMPLE_LONG_PLUS_12 | ADC_SAMPLE_AVERAGING_32);
    // additional sampling clocks
    adc_setup.int_adc_result = &samples;
    adc_setup.int_adc_bit_b = ADC_DISABLED; // channel B only valid in HW triggered mode
    adc_setup.int_adc_int_type = (ADC_END_OF_SCAN_INT);


    fnConfigureInterrupt((void *)&adc_setup);                            // configure and start next sequence
    fnADCresult();

}

This results in a value of 0x0000. from the result (which isn't correct).

After/if I get this working, I definitely wouldn't know how to get chaining to work for using both inputs at the same time!

Thanks




4
NXPTM M522XX, KINETIS and i.MX RT / Caching of (XiP) Flash?
« on: March 13, 2024, 01:09:16 AM »
I am having a situation where immediately after clearing flash in the SerialLoader, reading back from flash returns the old value before the erase.  Is there a cache for the external Flash that needs to be flushed?

I tried fnCommandCache(INSTRUCTION_CACHE_INVALIDATE | DATA_CACHE_INVALIDATE);  But that seems to only be for the TCM memories.

thanks

5
µTasker general / Method for Serial Loader to track application version?
« on: February 27, 2024, 11:58:22 PM »
I am looking at using a version number on my application to see if the Serial Loader should perform an update, instead of doing a byte for byte check of flash to compare the current application with the incoming file to see if they are the same.

Is there already this concept built into the Serial Loader?   

Otherwise, I will look at modifying the application header to include a version in the update file and check this against the application in flash with a modified Serial Loader.

thanks
JK

6
NXPTM M522XX, KINETIS and i.MX RT / un-enumerate USB Device loader?
« on: February 27, 2024, 04:49:01 PM »
I would like to un-enumerate (disconnect) the uTasker USB device after a successful upload of a firmware file.  Is there a way to create a function opposite of the
Code: [Select]
fnConfigureUSB(void) function to call before suspending the task?

thanks
JK

7
NXPTM M522XX, KINETIS and i.MX RT / Serial Loader: Placing vars into SDRAM?
« on: February 05, 2024, 04:01:48 PM »
I am trying to figure out how to place a file buffer into i.MX RT SDRAM in the Serial Loader application.   I am receiving my (binary, not SREC) update file via slow UART and would like to capture the entire file into a buffer (4MB) before erasing and then flashing XiP memory.

Is there an example of placing a specific var into SDRAM memory?

Thanks
JK

8
Is there a section in the config file to set alternate pins for these SDCARD functions?

I didn't see any way to select an arbitrary GPIO pin for card detect (as can be done in the MCUXpresso SDK).  I did manually change the PWREN pin, and I haven't found the VSELECT pin setting yet.

JK

9
In the guide (page 21): https://www.utasker.com/docs/iMX/MCUXpresso.pdf

It states that FlexRAM can be preconfigured for the application:

Quote
In comparison, this one has the desired FlexRAM configuration:
02f8 // first two bytes specify the length
030805ffffff // specify DTC/ITC and OCR bank sizes to be
pre-configured for the application (when not ff)
ffffffffffffffff
ffffffffffffffff
followed by further ff padding bytes
....
3 banks to be assigned to DTC, 8 to ITC and 5 to OCR

Does the number of banks include the mandatory 512k OCR banks on the 1062?

For example, in my app I have DTC = 512k, ITC = 0k, OCR = 512k
Would the header.txt be?:
Code: [Select]
02f8                   // first two bytes specify the length
0f000fffffff           // specify DTC/ITC and OCR
ffffffffffffffff
ffffffffffffffff

Also, in the example the byte count is shorter by than the blank 0xff padding, is this intentional?

10
I have a USB isolator (ADuM3160) on my design which limits he USB speed to 12 Mbps (FS) for the USB device port. 
The USB host port does not have this limitation.

Is there a way to define the USB ports of the iMX to be fullspeed on just the device port (or any port)?

I tried to change a few defines in iMX.h around line 1172, but it seems to configure both ports simultaneously, and I could not get USB_FS_INTERFACE to build at all.

Code: [Select]
// HSUART configuration
//
#define USB_HS_INTERFACE
#if defined iMX_RT105X || defined iMX_RT106X
    #define HSUSB_CONTROLLERS   2
#else
    #define HSUSB_CONTROLLERS   1
#endif
#define iMX_HSUSB_1             0
#define iMX_HSUSB_2             1
#define USBS_AVAILABLE          HSUSB_CONTROLLERS

11
OK,  moving on to building my existing NXP SDK application...

I made the appropriate changes to my application and generated a loadable .bin

Trying to actually load the file with the SerialLoader (via SD Card)  throws an error "File oversized!"

The application is 2.3MB, which should leave plenty of room in flash (4MB - bootLoader area).

I did some searching for the error in the SerialLoader and I see in iMX.h that there is a define:
Code: [Select]
#define APPLICATION_FLASH_AREA_SIZE       (512 * 1024)                   // third area in QSPI flash reserved for firmware upload area
Does this need to be increased to use more of flash for my application?


12
µTasker general / MacOS version of uTasker utilities?
« on: May 08, 2021, 02:54:15 PM »
Is there a Mac version of uTaskerCombine compiled somewhere?

I did find the Mac version of uTaskerConvert here: https://www.utasker.com/forum/index.php?topic=1445.msg5514#msg5514, it does look a bit out of date.

Thanks

13
Hello,

I have started to work with uTasker SerialLoader on an Embedded Artists iMX1062 EVK.  I can successfully write the Serial Loader with MCUBootUtility, but when I place "software.bin" on the SD card and the Loader picks it up, it just stops on "File valid".

If I used the USB-MSD method, by placing the software.bin from the PC on UPLOAD_DISK, then it works correctly.

Any ideas why it wouldn't use the software.bin directly from the SD card?

Here is a video of my entire process:


Pages: [1]