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.


Messages - mark

Pages: 1 ... 5 6 [7] 8 9 ... 219
91
STTM STM32 and STR91XF / Re: STM32 uTaskerBoot Project
« on: December 26, 2021, 02:07:55 AM »
Hi

I am sorry that i didn't respond earlier:

1. I also found that the jump was not enabled for STM32 and the new dependency is correct.

2. I don't see the code causing the hard fault but I assume that it is due to the routine checking the flash content at an incorrect address/range (if you look at the call stack you can see the routine that resulted in the error - and also if you single step out of the hard fault handler (in disassembly mode) it will return to the instruction causing the error. You can see what address the instruction is using and verify that the range set up for the check is suitable for the part in question (like uFILE_START and UTASKER_APP_START).

Regards

Mark

92
STTM STM32 and STR91XF / Re: STM32 uTaskerBoot Project
« on: December 12, 2021, 11:03:16 PM »
Hi

When this command is executed there is the message "Boot code too long (> 1000). Terminating" and so no output content is generated.
The problem is that the "uTaskerBoot.bin" is 50k in size and the command tried to add the second file "uTaskerBM.bin" at the location 0x1000, which is not possible since this would be in the middle of the first file.

The basic issue is that the boot loader is being built with a linker script that locates the reset vector at the 0x08000000 but he reset of the code at 0x080c000 and so leaves a large gap between the two which makes the file large (this can be seen by opening the binary file in a hex editor and shows a large amount of 0x00 being inserted).

I believe the line in the linker script doing this is:

define symbol __ICFEDIT_region_CODE_start__ = 0x0800c000;

and is designed for use by programs that leave two flash sectors free for use by the parameter system. Since the boot loader doesn't use the parameter system this line is not appropriate and if you remove it it will presumably then generate loader code that is all in the first flash sector (and small).


The IAR out format is ELF format, which is not generated. You will therefore need to use a different loading technique than IAR's (which only allows loading files that it has created). ST Micro has a utility that is often used for this and, once the loader and the initial application are installed subsequent uploads can be performed by the application's loading method.

Regards

Mark


93
STTM STM32 and STR91XF / Re: STM32 uTaskerBoot Project
« on: November 29, 2021, 05:12:28 PM »
Hi

I have checked in an IAR9 project for STM32.

Regards

Mark

94
STTM STM32 and STR91XF / Re: STM32 uTaskerBoot Project
« on: November 27, 2021, 03:34:56 AM »
Hi

I just checked in some changes that add "STM32 BM Loader target" to the VisualStudio project (VS2019) and also a GCC make file build that can be started from the VS project (when STM32 + GCC Build target is selected).

Both Kinetis and STM32 targets built successfully in the simulator and cross-compiled to their binary images.

There are only a few actual STM32 HW targets in config.h but it is relatively easy to add new ones if needed.

Regards

Mark

95
NXPTM M522XX, KINETIS and i.MX RT / Re: CAN Interfaces on K24
« on: November 23, 2021, 02:33:15 PM »
Hi Alex

The K24 with 256k Flash has no FlexCAN but the one that you use (with 1MBytes Flash) does.
Note the condition:

..(defined KINETIS_K24 && (SIZE_OF_FLASH == (1024 * 1024))).. which enables one FlexCAN interface.


// CAN configuration
//
#if defined KINETIS_KV50
    #define NUMBER_OF_CAN_INTERFACES 3
#elif defined KINETIS_KS
    #if defined KINETIS_K22
        #define NUMBER_OF_CAN_INTERFACES 2
    #else
        #define NUMBER_OF_CAN_INTERFACES 1
    #endif
#elif defined KINETIS_K64 || defined KINETIS_KW36 || (defined KINETIS_K24 && (SIZE_OF_FLASH == (1024 * 1024))) || defined KINETIS_KE06 || defined KINETIS_KEA64 || defined KINETIS_KEA128
    #define NUMBER_OF_CAN_INTERFACES 1
    #if defined KINETIS_KE06 || defined KINETIS_KEA64 || defined KINETIS_KEA128
        #define MSCAN_CAN_INTERFACE                                      // MSCAN rather than FlexCAN
    #endif
#elif (KINETIS_MAX_SPEED == 72000000) && (defined KINETIS_K20 || defined KINETIS_K30)
    #define NUMBER_OF_CAN_INTERFACES 1
#elif (KINETIS_MAX_SPEED == 120000000) && defined KINETIS_K22
    #define NUMBER_OF_CAN_INTERFACES 1
#elif defined KINETIS_K24
    #define NUMBER_OF_CAN_INTERFACES 0
#elif (KINETIS_MAX_SPEED >= 100000000) && (defined KINETIS_K10 || defined KINETIS_K20 || defined KINETIS_K26 || defined KINETIS_K30 || defined KINETIS_K40 || defined KINETIS_K60 || defined KINETIS_K65 || defined KINETIS_K66 || defined KINETIS_K70 || (defined KINETIS_KE14 && defined KINETIS_K_FPU) || defined KINETIS_KE16 || defined KINETIS_KE18)
    #define NUMBER_OF_CAN_INTERFACES 2
#else
    #define NUMBER_OF_CAN_INTERFACES 0
#endif



In fact the
#elif defined KINETIS_K24
    #define NUMBER_OF_CAN_INTERFACES 0

is probably redundant as the default is 0 FlexCANs anyway.

Therefore make sure that you have SIZE_OF_FLASH set appropriately.

Regards

Mark

96
ATMELTM AT91SAM7X and AVR32 / Re: UC3A Device Support
« on: November 03, 2021, 02:02:24 AM »
Hi

The uTasker project actively supported the AVR32 between about 2009 and 2012 and it was quite popular at the time. Since then I have never heard of anyone using it any more though and I haven't done any work with it myself for about 9 years. This means that I don't remember all of the details any more except that the AVR32 support is still 'included' in the project and it should be compatible with the present version.

These are the reference boards that it has been used on:

    #define DEVICE_WITHOUT_CAN                                           // AVR32 project doesn't support CAN
  //#define AVR32_EVK1100                                                // evaluation board from ATMEL with Ethernet and LCD
  //#define AVR32_EVK1101                                                // evaluation board from ATMEL with AT32UC3B
  //#define AVR32_EVK1104
    #define AVR32_EVK1105                                                // evaluation board from ATMEL with Ethernet and GLCD
  //#define AVR32_AT32UC3C_EK                                            // evaluation board from ATMEL with UC3C GLCD and CAN
  //#define AVR32_UC3_C2_XPLAINED                                        // evaluation board from ATMEL with UC3C Ethernet


The project supports USB device and Ethernet and most peripherals but never supported CAN.

UC3A, UC3B and UC3C devices are supported (AT32UC3A is used on the EVK1105, for example).

As of now these have become legacy parts and so no active work is performed, meaning that apart from the available code, support would be very limited as I don't intend to normally work with the chips again. Since the AVR32 peripherals are highly compatible with those on SAM7 parts the available drivers should however prove to be mature.

Any specific support would probably need to be organised/agreed on since this may result in the need to re-learn the devices and tools again, which can mean a lot of effort that is unlikely to be used elsewhere again.

Generally I recommend looking at using the i.MX RT 1062 (1051, 1052, 1061, 1064) in case of Kinetis replacement since they can usually be found in small/medium quantities and are a modern evolution which is very much in support/development focus.

Regards

Mark

97
Hi

Yes, the address is just pas the end of the CAN message buffer and I am pretty sure that what happened is that the error loop was traversed more than once, but the message pointer left after the end of the memory the fist time.

In the following I have added a pointer to the start of the message buffers and set ptrMessageBuffer back to this each time that it goes around the error loop. This should allow multiple queued errors to be handled.

Thanks for the report!

Regards

Mark

Code: [Select]
static void fnCAN_error(int iChannel)
{
    unsigned char can_error_int_message[HEADER_LENGTH];
    KINETIS_CAN_CONTROL *ptrCAN_control;
    KINETIS_CAN_BUF *ptrMessageBuffer;
    KINETIS_CAN_BUF *ptrMessageBufferStart;
    volatile unsigned long ulError;                                      // read the error status register, clearing error bits

    can_error_int_message[MSG_DESTINATION_NODE] = INTERNAL_ROUTE;
    can_error_int_message[MSG_SOURCE_NODE]      = INTERNAL_ROUTE;
    can_error_int_message[MSG_DESTINATION_TASK] = CAN_ERROR_TASK;
    can_error_int_message[MSG_SOURCE_TASK]      = INTERRUPT_EVENT;

    switch (iChannel) {
    case 0:
        ptrCAN_control = (KINETIS_CAN_CONTROL *)CAN0_BASE_ADD;
        ptrMessageBufferStart = MBUFF0_ADD_0;
        break;
    #if NUMBER_OF_CAN_INTERFACES > 1
    case 1:
        ptrCAN_control = (KINETIS_CAN_CONTROL *)CAN1_BASE_ADD;
        ptrMessageBufferStart = MBUFF0_ADD_1;
        break;
    #endif
    #if NUMBER_OF_CAN_INTERFACES > 2
    case 2:
        ptrCAN_control = (KINETIS_CAN_CONTROL *)CAN2_BASE_ADD;
        ptrMessageBufferStart = MBUFF0_ADD_2;
        break;
    #endif
    }

    while (((ulError = ptrCAN_control->CAN_ESR1) & (BIT1ERROR | BIT0ERROR | CAN_CRC_ERR | CAN_ACK_ERR | CAN_FRM_ERR | CAN_STF_ERR)) != 0) { // read the error status register, clearing error bits
    #if defined _WINDOWS
        ptrCAN_control->CAN_ESR1 &= ~(BIT1ERROR | BIT0ERROR | CAN_CRC_ERR | CAN_ACK_ERR | CAN_FRM_ERR | CAN_STF_ERR);
    #endif
        ptrMessageBuffer = ptrMessageBufferStart;
        if ((ulError & CAN_ACK_ERR) != 0) {                              // a transmission received no ack
            CANQUE *ptrCanQue = can_queue[iChannel];                     // we need to search for buffers which are transmitting
            int i = NUMBER_CAN_MESSAGE_BUFFERS;
            can_error_int_message[MSG_INTERRUPT_EVENT] = 0;
            while (i-- != 0) {
                if ((ptrCanQue->ucMode & CAN_TX_BUF_ACTIVE) != 0) {      // this buffer is presently transmitting a message
                    if (++(ptrCanQue->ucErrors) >= MAX_TX_CAN_TRIES) {   // we allow a few attempts before quitting (it also filters counting normal active buffers)
                        ptrMessageBuffer->ulCode_Len_TimeStamp = ((ptrMessageBuffer->ulCode_Len_TimeStamp & ~CAN_CODE_FIELD) | MB_TX_INACTIVE); // stop transmission
                        can_error_int_message[MSG_DESTINATION_TASK] = ptrCanQue->TaskToWake;
                        if ((ptrCanQue->ucMode & CAN_TX_BUF_REMOTE) != 0) {
                            can_error_int_message[MSG_INTERRUPT_EVENT] = CAN_TX_REMOTE_ERROR;
                            ptrCanQue->ucMode = (CAN_TX_BUF | CAN_RX_BUF_FULL | CAN_TX_BUF_REMOTE); // mark that it is an errored transmission buffer
                        }
                        else {
                            can_error_int_message[MSG_INTERRUPT_EVENT] = CAN_TX_ERROR;
                            ptrCanQue->ucMode = (CAN_TX_BUF | CAN_RX_BUF_FULL); // mark that it is an errored transmission buffer
                        }
                        break;
                    }
                }
                ptrCanQue++;
                ptrMessageBuffer++;
            }
        }
        else {
            ptrMessageBuffer->ulCode_Len_TimeStamp = (MB_TX_INACTIVE | (ptrMessageBuffer->ulCode_Len_TimeStamp & CAN_KEEP_CONTENTS)); // free the buffer
            can_error_int_message[MSG_INTERRUPT_EVENT] = CAN_OTHER_ERROR;
        }
        ptrCAN_control->CAN_ESR1 = ERRINT;                               // clear the error interrupt
    #if defined _WINDOWS
        ptrCAN_control->CAN_ESR1 &= ~(ERRINT);
    #endif
        if (can_error_int_message[MSG_INTERRUPT_EVENT] != 0) {
            uDisable_Interrupt();                                        // ensure interrupts remain blocked when putting message to queue
                fnWrite(INTERNAL_ROUTE, can_error_int_message, HEADER_LENGTH); // inform the handling task of event
            uEnable_Interrupt();
        }
    }
}

98
Hi

Yes, transfer errors due to noise or intermittent interference can never be excluded (also when slaves acknowledge) and it makes sense that the application layer is involved with ensuring that such things don't lead to erroneous behavior.

Some I2C devices, such as temperature and humidity sensors include CRCs in the data that they return in order to help identify bad values rather than blindly using what is received.
Some times the application may do a plausibility check (eg. if the temperature falls from 20°C to 0°C in one second it may prefer to filter the value rather than treat it as a valid result).
But in any case the application should always be aware of the fact that something may go wrong (as well as a slave device be missing or damaged) and consider being able to detected and handle such permanent and intermittent issues in a suitable fashion.

Regards

Mark

99
Hi

As mentioned in the referenced thread all I2C transfers are completed, even if slaves don't respond - this avoids a non-responsive slave from disrupting the overall operation and it is assumed that data read form slaves (which will be always 0xff in such a situation) would be an indication of a HW issue.

For the Kinetis there are no methods built into the driver that specifically check and avert of slaves Nacking data.

If it is a problem that needs to be detected once to see whether the HW is Ok or not it may be suitable to read expected data from the slave device and decide whether all is Ok or whether there is a problem based on the data read back (assuming a non-operating slave can be detected by the data that it returns).

If it is an intermittent problem that needs to be detected during use it may be necessary to add such a method, which - in the case of the LPI2C in the KE15Z - means checking LPI2Cx_MSR for the LPI2C_MSR_NDF flag, which indicates that the slave Nacked (I haven't tested the exact behavior but I understand that this is the flag indicating the fact, which needs to be written with '1' to clear it again). The question is however how best to react to such detection since it may be best to still let transfers complete to avoid general disruption. In the simplest case it could be to detect a global flag to indicate that it was detected or send an interrupt event to a task that then decides what needs to be done.

The next question is what to do in such circumstances - if it is a HW issue the code can only really signal that there is a problem so that the HW can be worked on since repeating and so on will presumably just result in the same failure (?)

Regards

Mark

100
Yes, that is correct - if you have a key-pad image (originally it was a key pad but in the meantime is used as a general board image for I/O visualisation) it needs to be bundled in the directory that you state. By distributing a zipped image of the directories and files it can be unzipped and executed.
If you want to distribute with a flash image (eg. a file system for web pages etc.) also the flash_xxx.ini can be included so that it loads the internal (or SPi flash, or SD card or memory stick etc.) image when it starts.

The idea is that you can send the project (simulation of "product") so that your customer can test its operation even when the HW is not yet ready - this allows finding deviations from the spec at an early state and have these corrected and verified asap.  It allows front panel and LCD control, various peripherals and networking to be included and test sequences (injecting data on ports or interfaces, for example) to exercise standard operating sequences.

It is one of the main features of the uTasker project but one that is not always given that much attention since many people dismiss simulation as not useful because they are more interested in seeing things running on the HW. But it allows great savings in development time and much more accurate/tested implementations if used as intended.

I am pleased you found it useful.

Regards

Mark

101
Hi

Add _EXE as a pre-processor define when building the project that you want to distribute.

This will change the path that is used to open the missing image from something like
"..//..//..//Hardware//Kinetis//GUI//kinetis_lan.bmp"
to
"kinetis_lan.bmp"

and allow you to simply 'bundle' the image with the *.exe file. As long as it is in the same directory as the *.exe itself it will be able to load the image.

Regards

Mark


102
µTasker general / Re: IAR EWARM v9 Support
« on: July 21, 2021, 02:37:19 PM »
Hi

I have been using 8.50.9.
From experience the exact version shouldn't make any noticeable difference - no code changes have been made for IAR since initial IAR 4 compatibility and the new IAR versions generally are due to changes in he IDE itself (editor, debugger) and the additional of more processor types that it supports.
In addition since the move form IAR4 to IAR5 (which lost compatibility with the IDE projects) subsequent generations have always been backward compatible.

Regards

Mark

103
NXPTM M522XX, KINETIS and i.MX RT / Re: SD Card Format Speed
« on: July 13, 2021, 07:13:20 PM »
Alex

That is a long time for the formatting to take - I expect maybe 30s or a minute if doing a quick format (which deletes the FAT but not all sectors - a full format (also wiping out old data in the sectors) will take a lot longer.

The mass storage task will be doing this by deleting a sector at a time and the sector writes (setting content to 0) will usually take about 4ms each. Then the task allows other tasks to run and continues with the next, repeating until finished.

What is the time gap between each iteration? Is there something running between each which slows the overall operation?

Ultimately the format time is the sum of the time to erase each sector in the FAT table (whereby there are 2 copies maintained and so the overall time is double) plus any other time added between iterations.

Regards

Mark


104
USB / Re: USB on Windows 10
« on: July 13, 2021, 02:05:55 AM »
Hi Phil

Some time in June 2021 I had an experience with USB-MSD that would not operate well although the code is several years old and hadn't behaved like this before. With Windows 10 and possibly after a Windows update.

My feeling is that something has been sped up in the enumeration/initialisation and what I saw was that set-ups with data were sent while previous handshakes had no yet completely terminated (queued) and what would happen is that the receiver in the HW would lose synch with the data toggling and drop a reception frame believing its data toggle was incorrect. This causes the host to wait maybe 10..15s and then reset and re-enumerate where is would often then work.

To (hopefully) resolve this 'race-state' I added a modification to kinetis_USB_FS_OTG.h as follows:

    07.06.2021 Resynchronise data buffers when sending status stage to ensure no race state on subsequent SETUP reception+ DATA {14}

If you have access to this (it is in branch V2.0.0 of the GIT repository) you may find that it solves the issue - I haven't seen it since but haven't used USB device on the Kinetis a great deal since then.

This is the actual modification that you could build in otherwise, in fnProcessInput():

    switch (fnUSB_handle_frame(ucFrameType, (unsigned char *)ptUSB_BD_rx->ptrUSB_BD_Data, iEndpoint_ref, ptrUSB_HW)) { // generic handler routine
    case TERMINATE_ZERO_DATA:                                            // send zero data packet to complete status stage of control transfer
        if (iEndpoint_ref == 0) {                                        // {14} resynchronise data buffers when sending status stage
            if (&ptEndpointBD->usb_bd_rx_even == ptUSB_BD_rx) {
                ptEndpointBD->usb_bd_rx_even.ulUSB_BDControl |= (DATA_1);
                ptEndpointBD->usb_bd_rx_odd.ulUSB_BDControl &= ~DATA_1;
                ptEndpointBD->usb_bd_rx_odd.ulUSB_BDControl |= OWN;
            }
            else {
                ptEndpointBD->usb_bd_rx_odd.ulUSB_BDControl |= (DATA_1);
                ptEndpointBD->usb_bd_rx_even.ulUSB_BDControl &= ~DATA_1;
                ptEndpointBD->usb_bd_rx_even.ulUSB_BDControl |= OWN;
            }
        }

        *ptrUSB_HW->ptr_ulUSB_BDControl = (OWN | ptrUSB_HW->ptrEndpoint->ulNextTxData0); // transmit a zero data packet on control endpoint
        _SIM_USB(0, USB_SIM_TX, iEndpoint_ref, ptrUSB_HW);
        ptrUSB_HW->ptrEndpoint->ulNextTxData0 ^= DATA_1;                 // toggle the data packet



It utilises the point when it is sending a zero frame status stage (just before the host will be allowed to send further sequences) to reset the rx toggle buffer to be sure that they are both ready to receive data 0 and data 1 tokens Previously there was a very small window where the data toggle may not have been correct in both and when the host very quickly sends a following setup and data to the two one may not be correct and thus the data dropped (since the HW thinks it is a repetition it ACKs it though, so the host thinks all is good but times out waiting for the actual response).

Regards

Mark



105
µTasker general / Re: Failure of Start bit generation in I2C
« on: July 04, 2021, 11:46:22 PM »
Hi

There is no difference to the I2C in these parts.
Have you measured the bus signals to check that it is in the correct (idle) state so that a start condition can be successfully sent?

Regards

Mark

Pages: 1 ... 5 6 [7] 8 9 ... 219