Recent Posts

Pages: 1 ... 6 7 [8] 9 10
71
I should add I appear to be getting the same result in the simulator.  This is where my debug effort currently is.   
72
Hi Mark,
I really thought I had the SNMP traps working, but somehow It is again failing.  To troubleshoot, I temporarily added 7 MIB spots for the ARP table as a debug because CLI isn't available.  On the included wireshark filtered capture  the first entry is ARP to the SNMP manager, and my 2 test traps flow freely   .  then appx 75 seconds in it appears to be an ARP refresh?
then traps are locked out   then 5 minutes later a gateway ARP refresh? then 5 minutes later traps begin for a short time, then ARP blocking again.  Eventually the system locks up with this - but my Modbus polling is good and SNMP GET communication is unaffected?   Just traps.

Since this is very odd behavior, I'm guessing that my method for sending traps is the problem. 
However, my ARP table is full of unwanted entries despite having ARP_IGNORE_FOREIGN_ENTRIES defined.



so I think I've got 2 questions:
1)  Is the ARP_IGNORE_FOREIGN_ENTRIES  supposed to ignore all random ARP requests on the network?  It doesn't appear to do this based on the ipaddresses in the ARP table

2)  Do SNMP traps need to be implemented in a specific way so that they get an ARP notification?  do they need to be called within the snmp void fnSNMP(TTASKTABLE *ptrTaskTable)??


Thanks
Ray




in my MIB handler, the extern unsigned char fnInitialiseSNMP(void)  ( called in Application.c - in my fnPIT_timerTask  every 5 seconds)

        if (ulCount_5000ms) --ulCount_5000ms;
        else
        {
          ulCount_5000ms = 500;
          if (SnmpStarted == 0)
          {
           if( fnInitialiseSNMP() == 1) SnmpStarted = 1;
          }
          else
          {
            if (SendColdStartTrap == 0)
            {
                fnSendSNMPTrap(SNMP_COLDSTART, 0, 1);//ALL_SNMP_MANAGERS);
                SendColdStartTrap = 1; 
            }
            else// cold start has been sent
            {
              fnSendSNMPTrap(SNMP_COLDSTART, 0, 1);//  test with just the easy to send trap
            }
          }

73
NXPTM M522XX, KINETIS and i.MX RT / i.MX RT TEMPMON
« Last post by mark on July 11, 2023, 09:30:29 PM »
The i.MX RT 10xx includes a temperature monitor module (TEMPMON) that allows interrupts to be generated if the core temperature exceeds two programmable high temperature levels or falls below a low programmable lower limit level.

Software can also read the present die temperature at any time.

In order for it to work correctly it needs the bandgap reference to be enabled, plus the 480MHz PLL and the 32kHz RTC modules to be operating.

The temperature monitor is factory calibrated and the calibration values can be read from the HW_OCOTP_ANA1 registers. These are used by software to extrapolate the temperature and also to correctly set temperature limits.

The support in the µTasker project is enabled with the define SUPPORT_TEMPMON which adds an interface to read the core temperature via the ADC API in a compatible manner for projects that also run on processors that use ADC based temperature reading.

An example of reading the temperature periodically can be activated in ADC_Timers.h by activating the define ADC_INTERNAL_TEMPERATURE when using the ADC reference. For compatibility the ADC API is used with the input set to

adc_setup.int_adc_bit = ADC_TEMP_SENSOR; // ADC internal temperature

which is how ADC based temperature reading is performed.

Although there is no interrupt generated when the measurement has completed such an interrupt is emulated so that applications remain compatible. The only difference is that the result returned when collecting the value is in °C x 100 (allowing hundredth of degree resolution) and not the raw ADC value itself. Therefore the only modification at the application level is to remove any HW specific conversion that may originally have been performed and use the result directly (or after modification to the desired form). The following shows retrieving and rounding to 1°C resolution:

Code: [Select]
ADC_SETUP adc_setup; // interrupt configuration parameters
ADC_RESULTS results;
adc_setup.int_type = ADC_INTERRUPT; // identifier
adc_setup.int_adc_mode = (ADC_READ_ONLY | ADC_GET_RESULT);
adc_setup.int_adc_controller = 0;
adc_setup.int_adc_result = &results;
fnConfigureInterrupt((void *)&adc_setup);
results.sADC_value[0] += 50;
results.sADC_value[0] /= 100; // the approximate temperature
rounded up/down to 1°C
fnDebugDec(results.sADC_value[0], DISPLAY_NEGATIVE);
fnDebugMsg(" degC\r\n");

In this particular case the conversion was started previously and it shows just the subsequent retrieval. The conversion was started using the standard API for the ADC with the ADC_TEMP_SENSOR defined as input. When multiple ADC controllers are implemented in the i.MX RT the same one should be referenced for the conversion and retrieval, although there is only one TEMPMON module shared by both and the ADC controller is not actually used.
74
NXPTM M522XX, KINETIS and i.MX RT / Re: Closing and reopening handles
« Last post by mark on June 21, 2023, 03:24:47 PM »
Hi Neil

You can call with the ucDriverMode set to MODIFY_CONFIG is you want to change the UART settings (such as the baud rate).

The UART doesn't support close and re-open since this is something that is never (up to now) needed in an embedded system. It would be possible since the driver handles a close but it would require the UART's memory management to be changed to use dynamic heap (such as when the buffer sizes need to change) rather than uMalloc() as it presently uses.

If you want to stop the UART for some time you can also do

fnDriver( GSMPortID, ( TX_OFF | RX_OFF ), 0 );

and then later re-enable it with

fnDriver( GSMPortID, ( TX_ON | RX_ON ), 0 );

Regards

Mark

75
NXPTM M522XX, KINETIS and i.MX RT / Closing and reopening handles
« Last post by neil on June 21, 2023, 10:51:30 AM »
Hi Mark,
  Hope you are keeping well..

I call the below to open a Uart and pulse input channels. If I want to call the routine again, do I have to close any handles first? If so how is this done?

Best Regards
Neil

--------------------------

TTYTABLE tGSMInterfaceParameters;                                       // table for passing information to driver
QUEUE_HANDLE fnSetGSMSerialMode(unsigned char ucDriverMode)//
{
    GPTIMER_SETUP gptimer_setup;                                         // interrupt configuration parameters
    tGSMInterfaceParameters.Channel = 1;                            // set UART channel for serial use
    tGSMInterfaceParameters.ucSpeed = SERIAL_BAUD_115200; // baud rate
    tGSMInterfaceParameters.Rx_tx_sizes.RxQueueSize = 400;       // input buffer size
    tGSMInterfaceParameters.Rx_tx_sizes.TxQueueSize = 800;       // output buffer size
//    tGSMInterfaceParameters.Rx_tx_sizes.TxQueueSize = 3000;       // output buffer size Large size as may be used with diagnostics
   
    tGSMInterfaceParameters.Task_to_wake = TASK_GSM;                        // wake self when messages have been received
    tGSMInterfaceParameters.Config = (CHAR_8 | NO_PARITY | ONE_STOP | CHAR_MODE | RTS_CTS |  INFORM_ON_FRAME_TRANSMISSION);
 //   tGSMInterfaceParameters.ucDMAConfig = 0; // NO DMA for UART1

    gptimer_setup.int_type = GPT_TIMER_INTERRUPT;
    gptimer_setup.int_handler = DCDPulse_int;
    gptimer_setup.channel = 1;                                           // general purpose timer channel 1
    gptimer_setup.int_priority = GPTIMER0_INTERRUPT_PRIORITY;            // define interrupt priority
    gptimer_setup.mode = GPT_CAPTURE_RISING_EDGE; // set up capture mode and define the timer clock
                                                                     
    gptimer_setup.usCaptureCount = 0;                         // request this many capture values to be recorded before calling our interrupt
    gptimer_setup.capture_list = 0;                          // the capture list for saving to
   fnConfigureInterrupt((void *)&gptimer_setup);                        // enter interrupt for DMA timer test
    if ((GSMPortID = fnOpen( TYPE_TTY, ucDriverMode, &tGSMInterfaceParameters )) != 0)
     { // open or change the channel with defined configurations (initially inactive)
        fnDriver( GSMPortID, ( TX_ON | RX_ON ), 0 );                  // enable rx and tx
      if (tGSMInterfaceParameters.Config & RTS_CTS) {                   //

            fnDriver( GSMPortID, (MODIFY_INTERRUPT | ENABLE_CTS_CHANGE), 0 ); // activate CTS interrupt when working with HW flow control (this returns also the present control line states)
            fnDriver( GSMPortID, (MODIFY_CONTROL | SET_RTS), 0 );     // activate RTS line when working with HW flow control

        }
     }
         
    return GSMPortID;     
}
76
STTM STM32 and STR91XF / Re: how to configure SPI pins for bootloading (STM32F405)
« Last post by mark on June 14, 2023, 10:30:40 PM »
Hi Alex

If you look in app_hw_stm32.h there are some setups for SDHC and SPI interfaces.

For example:

Code: [Select]
                // Configure to suit SD card SPI mode at between 100k and 400k
                //
                #define SDCARD_CS                  PORTC_BIT11
                #define SDCARD_MISO                PORTB_BIT4
                #define SDCARD_MOSI                PORTB_BIT5
                #define SDCARD_CLK                 PORTB_BIT3
                #define INITIALISE_SPI_SD_INTERFACE() _CONFIG_PORT_OUTPUT(C, SDCARD_CS, (OUTPUT_FAST | OUTPUT_PUSH_PULL)); _SETBITS(C, SDCARD_CS); \
                        POWER_UP(APB1, RCC_APB1ENR_SPI3EN); \
                        _CONFIG_PERIPHERAL_INPUT(B, (PERIPHERAL_SPI3_I2S3ext), (SDCARD_MISO), (INPUT_PULL_UP)); \
                        _CONFIG_PERIPHERAL_OUTPUT(B, (PERIPHERAL_SPI3_I2S3ext), (SDCARD_CLK | SDCARD_MOSI), (OUTPUT_PUSH_PULL | OUTPUT_MEDIUM)); \
                        RCC_APB1RSTR |= RCC_APB1RSTR_SPI3RST; RCC_APB1RSTR &= ~RCC_APB1RSTR_SPI3RST; \
                        SPI3_CR1 = (SPICR1_BR_PCLK2_DIV128 | SPICR1_MSTR | SPICR1_SSI | SPICR1_CPOL | SPICR1_CPHA | SPICR1_SSM); \
                        SPI3_I2SCFGR = 0; \
                        SPI3_CR1 = (SPICR1_SPE | SPICR1_BR_PCLK2_DIV128 | SPICR1_MSTR | SPICR1_SSI | SPICR1_CPOL | SPICR1_CPHA | SPICR1_SSM);

                #define SHARE_SPI                                        // ensure that LCD operations are terminated to avoid conflicts
                #define POWER_UP_SD_CARD()                               // apply power to the SD card if appropriate
                #define ENABLE_SPI_SD_OPERATION()
                // Set maximum speed
                //
                #define SET_SPI_SD_INTERFACE_FULL_SPEED() SPI3_CR1 = (SPICR1_SPE | SPICR1_BR_PCLK2_DIV2 | SPICR1_MSTR | SPICR1_SSI | SPICR1_CPOL | SPICR1_CPHA | SPICR1_SSM)
                #if defined _WINDOWS
                    #define WRITE_SPI_CMD(byte)      SPI3_DR = (unsigned short)byte; SPI3_DR = _fnSimSD_write((unsigned char)byte)
                    #define WAIT_TRANSMISSON_END()   while ((SPI3_SR & SPISR_TXE) == 0) { SPI3_SR |= SPISR_TXE;} \
                                                     while (SPI3_SR & SPISR_BSY) {SPI3_SR &= ~SPISR_BSY;}
                #else
                    #define WRITE_SPI_CMD(byte)      SPI3_DR = (unsigned short)byte
                    #define WAIT_TRANSMISSON_END()   while ((SPI3_SR & SPISR_TXE) == 0) {} \
                                                     while (SPI3_SR & SPISR_BSY)
                #endif
                #define READ_SPI_DATA()              (unsigned char)SPI3_DR

                #define SET_SD_DI_CS_HIGH()           _CONFIG_PORT_OUTPUT(C, SDCARD_MISO, (OUTPUT_FAST | OUTPUT_PUSH_PULL)); _SETBITS(C, SDCARD_MISO); _SETBITS(C, SDCARD_CS) // force DI and CS lines high ready for the initialisation sequence
                #define SET_SD_CARD_MODE()            _CONFIG_PORT_INPUT(C, (SDCARD_MISO), (INPUT_PULL_UP | PULLUP_BIT11));
                #define SET_SD_CS_LOW()               _CLEARBITS(C, SDCARD_CS) // assert the CS line of the SD card to be read
                #define SET_SD_CS_HIGH()              _SETBITS(C, SDCARD_CS) // negate the CS line of the SD card to be read

Using this as reference you can adapt the SPI instance and pins to match your HW.

Regards

Mark

77
STTM STM32 and STR91XF / how to configure SPI pins for bootloading (STM32F405)
« Last post by Alex1982 on June 14, 2023, 06:25:11 PM »
Hello!
I'd like to create an SD bootloader for the STM32F405RGTx except I'm using SPI for the SD card interface, not SDIO

Can you please advise how to proceed to set up SPI card and where to define the SPI pins?

I'm using utaskerSerialBoot V1.4.3 within uVision Keil IDE, compiling fine!

Thanks in advance!

Regards
Alex
78
NXPTM M522XX, KINETIS and i.MX RT / Re: Kinetis K60 Ethernet phy MDIO comm. problem
« Last post by mark on May 31, 2023, 10:41:46 PM »
Hi Ray

I am please that you managed to catch the issue.

Regards

Mark
79
NXPTM M522XX, KINETIS and i.MX RT / Re: Kinetis K60 Ethernet phy MDIO comm. problem
« Last post by Ray on May 31, 2023, 10:38:58 PM »
Hi Mark
I absolutely did not check that  :)   As I was reading thru the pdf manual it was mentioning the default phy address was 00001  4 weak pull downs, one weak pull up.  Yes, my PHY_ADDRESS was defined to 0.   setting to 1 and now I can read phy registers!!   

I've been waiting months to check that one off my list!

Thanks for the help!!

ray
80
NXPTM M522XX, KINETIS and i.MX RT / Re: Kinetis K60 Ethernet phy MDIO comm. problem
« Last post by mark on May 31, 2023, 08:01:57 PM »
Hi Ray

don't forget that the PHY has an address that is set via straps. Make sure that its address matches PHY_ADDRESS.
Or you can try SCAN_PHY_ADD which will scan all possible addresses to see whether the ID can be read on one of them.

Good luck

Regards

Mark

Pages: 1 ... 6 7 [8] 9 10