Recent Posts

Pages: 1 2 3 [4] 5 6 ... 10
31
NXPTM M522XX, KINETIS and i.MX RT / Re: Serial Loader: Placing vars into SDRAM?
« Last post by jackking on February 06, 2024, 01:00:33 AM »
OK, that is similar to what I tried, without success. 

I set the following in config.h of uTaskerBoot:
Code: [Select]
#define BOOT_LOADER_SUPPORTS_SDRAM
I set the following in app_hw_iMX.h of uTaskerSerialBoot:

Code: [Select]
    #define SDRAM_SIZE          (32 * 1024 * 1024)                       // 32MByte
    #define BOOT_LOADER_SUPPORTS_SDRAM
    #define SDRAM_START_ADDRESS     0x80000000
    #define DISABLE_SDRAM_CACHE
    #define SEMC_AVAILABLE

and added your routine as a menu item under "rd" for RAM DUMP:
Code: [Select]
else if ((ucSerialDebugInputMessage[0] == 'r')
|| (ucSerialDebugInputMessage[0] == 'R')) {
if ((ucSerialDebugInputMessage[1] == 'd')
|| (ucSerialDebugInputMessage[1] == 'D')) {

fnDebugMsg("\r\nWrite SDRAM: ");
unsigned char *ptrSDRAM = (unsigned char *)SDRAM_ADDR;
unsigned long ulTestCnt = (4 * 1024 * 1024);
unsigned char ucByte = 0;
while (ulTestCnt--  != 0) {
    *ptrSDRAM++ = ucByte++;
}

fnDebugMsg("\r\nDump SDRAM: ");
ptrSDRAM = (unsigned char *)SDRAM_ADDR;
ulTestCnt = (4 * 1024 * 1024);
while (ulTestCnt--  != 0) {
    fnDebugHex((unsigned char) *ptrSDRAM++, (sizeof(unsigned char)));
}

break;
}
}

Which instantly crashes when trying to write past 0x20 bytes.  It also crashes immediately on the read back of the first byte, if I write less than 0x20 bytes.
32
NXPTM M522XX, KINETIS and i.MX RT / Re: Serial Loader: Placing vars into SDRAM?
« Last post by mark on February 05, 2024, 11:09:40 PM »
Hi

If you enable
#define BOOT_LOADER_SUPPORTS_SDRAM                   // enable when the boot loader is to configure SDRAM for subsequent application use (or when application runs in SDRAM)
when building the primary loader the SDRAM can be used by the serial loader or the application without needing to configure there.

The SDRAM is located at 0x80000000 [SDRAM_ADDR] and so the easiest way to store data to is to use a pointer as follows:

Code: [Select]
unsigned char *ptrSDRAM = (unsigned char *)SDRAM_ADDR;
unsigned char ucByte = 0;
unsigned long ulTestCnt = (4 * 1024 * 1024);
while (ulTestCnt--  != 0) {
    *ptrSDRAM++ = ucByte++;
}
which should, as example,  leave a 0x00, 0x01, 0x02... pattern throughout 4Meg of the SDRAM.

Regards

Mark
33
NXPTM M522XX, KINETIS and i.MX RT / Serial Loader: Placing vars into SDRAM?
« Last post by jackking 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
34
NXPTM M522XX, KINETIS and i.MX RT / i.MX RT Guide to Setting Peripheral Functions
« Last post by mark on January 24, 2024, 08:26:01 PM »
Hi All

This example shows how to configure a peripheral pin with help if the _CONFIG_PERIPHERAL() or _CONFIG_PERIPHERAL_LOOPBACK() macros.

As an example I will configure LPSPI3_SCK function on the pin referenced as GPIO_AD_B1_15 (assuming an i.MX RT 106x)


This is the code:

IOMUXC_LPSPI3_SCK_SELECT_INPUT = IOMUXC_LPSPI3_SCK_SELECT_INPUT_GPIO_AD_B1_15_ALT2;
_CONFIG_PERIPHERAL_LOOPBACK(GPIO_AD_B1_15, LPSPI3_SCK, (IOMUXC_SW_PAD_CTL_PAD_PKE | IOMUXC_SW_PAD_CTL_PAD_SPEED_MEDIUM | IOMUXC_SW_PAD_CTL_PAD_DSE_6));


and this is how one arrives at it:

1. One needs to know which GPIO reference (PAD) it is on -> GPIO_AD_B1_15 in this case

2. One searches for this in iMX.h until one finds the list of mux options belonging to it

    #define GPIO_AD_B1_15_FLEXSPIA_SS0_B           (IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT0)
    #define GPIO_AD_B1_15_ACMP_OUT03               (IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT1)
    #define GPIO_AD_B1_15_LPSPI3_SCK               (IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT2)
    #define GPIO_AD_B1_15_SAI1_TX_SYNC             (IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT3)
    #define GPIO_AD_B1_15_CSI_DATA02               (IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT4)
    #define GPIO_AD_B1_15_GPIO1_IO31               (IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT5)
    #define GPIO_AD_B1_15_USDHC2_DATA7             (IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT6)
    #define GPIO_AD_B1_15_KPP_COL00                (IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT7)
    #if defined iMX_RT106X
        #define GPIO_AD_B1_15_ENET2_1588_EVENT3_IN (IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT8)
        #define GPIO_AD_B1_15_FLEXIO3_FLEXIO15     (IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT9)
    #endif



3. One take the full mux name (GPIO_AD_B1_15_LPSPI3_SCK) and insert it into the macro, with a comma separating the GPIO reference and the peripheral mux reference belonging to that GPIO:

 _CONFIG_PERIPHERAL_LOOPBACK(GPIO_AD_B1_15, LPSPI3_SCK, (IOMUXC_SW_PAD_CTL_PAD_PKE | IOMUXC_SW_PAD_CTL_PAD_SPEED_MEDIUM | IOMUXC_SW_PAD_CTL_PAD_DSE_6));


This can't be done wrong since it will not compile if incorrect GPIOs aad peripherals are attempted.
The characteristics (last parameter) can be modified to control drive strength and slew rate, etc.

4. Note that either _CONFIG_PERIPHERAL() or _CONFIG_PERIPHERAL_LOOPBACK() is used.
The first is used in most cases but the _CONFIG_PERIPHERAL_LOOPBACK() one is needed for some signals that are generated to be driven onto the pin and also need to be looped back internally to be driven to the peripheral itself. In the case of the LPSPI master operation this MUST be used for the CLK otherwise the clock will be generated but not be connected internally, meaning it won't work completely.

5. Some peripheral pins need an additional sub-muxing setting since they can be located on multiple pins.

IOMUXC_LPSPI3_SCK_SELECT_INPUT = IOMUXC_LPSPI3_SCK_SELECT_INPUT_GPIO_AD_B1_15_ALT2;

To see whether it is necessary it is easiest to search iMX.h for IOMUXC_x (where x is the name of the peripheral signal) -> IOMUXC_LPSPI3_SCK
If it shows up as a IOMUX_xxxx_SELECT_INPUT register, like:

    #define IOMUXC_LPSPI3_SCK_SELECT_INPUT             *(unsigned long *)(IOMUXC_SW_BLOCK + 0x0510) // LPSPI3_SCK_SELECT_INPUT DAISY register
        #define IOMUXC_LPSPI3_SCK_SELECT_INPUT_GPIO_AD_B0_00_ALT7 0x00000000 // select GPIO_AD_B0_00 for mode: ALT7
        #define IOMUXC_LPSPI3_SCK_SELECT_INPUT_GPIO_AD_B1_15_ALT2 0x00000001 // select GPIO_AD_B1_15 for mode: ALT2


it should be set.

IOMUXC_LPSPI3_SCK_SELECT_INPUT = IOMUXC_LPSPI3_SCK_SELECT_INPUT_GPIO_AD_B1_15_ALT2;



One can get away without setting it in case the 0x00000000 is true since it defaults to that, but as good practice it is best to always set the value. It also means that when modifying such configurations one doesn't forget to check and set the value accordingly.

If there is no corresponding IOMUXC_xxxxx_SELECT_INPUT register there is no sub-mux setting to be made.


6. After making such changes one can run the simulator and hover the mouse over the pins one wants to check and it will show the present GPIO/peripheral function so one can easily verify that it is correct before testing on HW.



Regards

Mark
35
NXPTM M522XX, KINETIS and i.MX RT / Re: Compiler Issue
« Last post by mark on January 24, 2024, 08:13:58 PM »
Hi Neil

I have attached the missing folder as zip file.

Regards

Mark
36
NXPTM M522XX, KINETIS and i.MX RT / Re: Compiler Issue
« Last post by neil on January 22, 2024, 07:17:56 PM »
Hi Mark,
  My version doesnt have a CW10 project, would it be possible to get a copy of this?

Best Regards
Neil
37
NXPTM M522XX, KINETIS and i.MX RT / Re: Compiler Issue
« Last post by mark on January 19, 2024, 09:42:03 PM »
Hi Neil

It is a number of years since I last worked with Coldifre and with the CW IDEs, therefore I haven't had any practice for a very long time.
However there is a CW10 project in
\Applications\uTaskerV1.4\CodeWarrior_M522XX_CW10
and the IDE's project settings are in \Applications\uTaskerV1.4\CodeWarrior_M522XX_CW10\ProjectSettings - the content of that folder needs to be copied to the root of the project (above \Applications) and that should allow your to test that the CW 10 or 11 version can build the reference project [I haven't tested this for a very long time so can't guarantee there is not an incompatibility somewhere in the later versions but any issues will be due to prototype changes or new defines needing to be set somewhere, thus easily fixable].

Good luck

Regards

Mark

38
NXPTM M522XX, KINETIS and i.MX RT / Re: Compiler Issue
« Last post by neil on January 14, 2024, 09:34:08 PM »
Hi Mark,
  Because of the issues, I thought maybe better to upgrade, so I have downloaded Codewarrior v10.5 and V11.  Looking at the page https://www.utasker.com/kinetis/compilers.html#CW10  it mentions how to convert a current application (V7.1) to V10.x . Would this work for V11, or V10.5?

Looking at a previous post a while back, https://www.utasker.com/forum/index.php?topic=2042.0  , I started to try the upgrade, but got V7.1 to work. But now I am thinking of doing the upgrade.

I got stuck as I dont have  folders ".settings", ".cproject" etc.  as mentioned in the first paragraph of the conversion link above. And also I dont have a "project_settings" folder, or any "."folder.   These things are mentioned before starting codewarrior 10.0.

Many Thanks
Neil
39
NXPTM M522XX, KINETIS and i.MX RT / Compiler Issue
« Last post by neil on January 14, 2024, 01:29:59 PM »
Hi
  I understand this isnt a processor issue, but wonder if someone else has come across this before , and hopefully found a fix.

I am using Codewarrior 7.1 on Windows 10, and been working well for a few years now. But for some reason during debugging it doesnt display the variable values correctly. For some reason it simply repeats the variable name, see the attached.

Best Regards
Neil
40
Mark,

Thanks for that.  I was able to test it.  I think there is still some issue with the interrupt handler, I had to remove the SDHC_DETECT_INTERRUPT_GPIO exclusion in kinetis_SDHC.h before the card would move beyond the idle command.  After removing this, I was able to get the card mounted.

line 193 - before removing the exclusion:

Code: [Select]
#if (defined SDCARD_DETECT_INPUT_INTERRUPT && !defined SDHC_DETECT_INTERRUPT_GPIO)
    sdcard_handler[0] = int_handler;
        #if (defined _iMX && defined USE_uSDHC2)
    fnEnterInterrupt(irq_USDHC2_ID, SDCARD1_STATUS_INTERRUPT_PRIORITY, sdcard_state_change);
    SDHC2_IRQSIGEN = (SDHC_IRQSIGEN_CRMIEN | SDHC_IRQSIGEN_CINSIEN);     // enable interrupts on card insertion and removal
    SDHC2_IRQSTATEN = 0xffffffff;                                        // allow all enabled interrupts
        #else
    fnEnterInterrupt(irq_USDHC1_ID, SDCARD1_STATUS_INTERRUPT_PRIORITY, sdcard_state_change);
    SDHC_IRQSIGEN = (SDHC_IRQSIGEN_CRMIEN | SDHC_IRQSIGEN_CINSIEN);      // enable interrupts on card insertion and removal
    SDHC_IRQSTATEN = 0xffffffff;                                         // allow all enabled interrupts
        #endif
#endif
Pages: 1 2 3 [4] 5 6 ... 10