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

Pages: [1]
1
µTasker general / Cannot change the magic number
« on: October 07, 2009, 12:54:15 AM »
My project has just restarted after almost a year.

I am using the MCF52233 with an AT45DB321 SPI chip and encrypted bootloading. With the magic number set to 0x1235 I can upload and run new software using ftp (with a small caveat). I then set the defines in "application.h" in the app and in "uTaskerBootLoader.c in the bootloader to 0x4235. I then also edited the "BM-Convert_Encrypt.bat" batch file to suit. I can no longer upload new software. Upon reseting the target, it comes up right away with no delay. I assume the boot loader does not like the new file(s) and goes with the old one.

The caveat is that I seem to need both "H_Upload_Enc.bin" and "HS.bin" for it to work with 0x1235.

Any help would be appreciated and prevent an ulser.

Regards,
Ewan Macpherson.

2
µTasker general / CPU heavy task
« on: December 03, 2008, 09:20:28 PM »
Mark,

What is the general means of dealing with a task that consumes a lot of CPU time? In my case, 3 seconds of computation.

Thanks,
Ewan.

3
NXPTM M522XX, KINETIS and i.MX RT / Overflow in .flash1 using _ENCRYPTED
« on: December 01, 2008, 06:34:46 PM »
I have the boot loader working fine with my SPI chip. I decided to try out the encryption but I get the linker message "Overflow in segment: flash1 from section: .flash1 Segment reserved size is 0x0400 -- Overflow of: 0x0050". Is there something I need to take out or move to another module?

Thanks,
Ewan.

4
I have an application which is working as expected. I use an AT45DB321 for file system and sw upload. I relinked the application to start at 0x1000. I used the Axiom programmer to program both .ELFs into flash. All seems to work fine. I set both the uTaskerConvert and the bootloader for no encryption. Using the "Administration Page" in the target, it appears that I can upload the new "H_Upload.bin" successfully. When the target resets (either from the software or a power cycle) the old program is still running. I modified the boot loader code as follows to account for a second device on the SPI pins and because I use the nWP pin on the memory chip.

Code: [Select]
extern int fnConfigSPIFileSystem(void)
{
  DDRAS |= PORT_AS_BIT3;
  _SETBITS(AS, PORT_AS_BIT3);                   // raise RC531 nCS   ewan

  DDRAN |= PORT_AN_BIT7;
  _SETBITS(AN, PORT_AN_BIT7);                   // raise AT45DB nWP  ewan

    PORTQS |= QSPI_CS0_LINE;                                         
    DDRQS |= QSPI_CS0_LINE;                                              // Drive CS line high

    PQSPAR |= 0x0015;                                                    // Set QSPI_CLK, QSPI_DIN and QSPI_DOUT on QS port

    QMR = ((QSPI_MSTR | QSPI_8BITS) | 2);                                // set mode and fastest speed

    if (fnCheckAT45dbxxx() == NO_SPI_FLASH_AVAILABLE) {
        QMR = 0;                                                         // disable SPI if no chip connected
        return 1;
    }
    return 0;
}

The affected ports work fine in the application. Any clues?

Regards,

Ewan.

5
µTasker general / Delayed ACKs
« on: November 16, 2008, 08:40:23 PM »
I read some discussions about the problems concerning delayed ACKs. I could not find if the uTasked used such things nor if there was a setup to disable them. Is it possible to tell a server (Windows for example) that it will receive only one packet and that it should ACK immediately? What do the following signify?
TOS_NORMAL_SERVICE
TOS_MINIMISE_DELAY
TOS_MAXIMISE_THROUGHPUT
TOS_MAXIMISE_RELIABILITY
TOS_MINIMISE_MONETARY_COST

I can see where they are used but I don't see why one is used instead of another.

Thanks,

Ewan.

6
NXPTM M522XX, KINETIS and i.MX RT / Serial ports creating characters
« on: November 05, 2008, 10:11:29 PM »
I have both ports interconnected so that I can easily check the hardware. The output of port 0 is connected to the input of port 1 and vice versa. I send a char 'A' which is then properly received according to the debugger. I then take whatever was received and add 1 to it (to get a 'B' hopefully). I then send the 'B' out on the other port and again (according to the debugger) the correct character is received. When I say character I mean that ucRx[0] = the character, and ucRx[1] = 0. My problem is that when I attach an oscilloscope to the second output there is not just a 'B' but a 'B' followed by an 'A'.
Code: [Select]
void fnRC531 (TTASKTABLE *)
{
  INTERRUPT_SETUP                 interrupt_setup;
  TTYTABLE                        tInterfaceParameters;
  static QUEUE_HANDLE             SerialPortID0, SerialPortID1;
 
  volatile unsigned char          receive, receive2;
  static unsigned char            FirstTime = TRUE;
 
  unsigned char                   ucRx[RX_BUFFER_SIZE];
  unsigned char                   ucLength;

 
  if (FirstTime == TRUE)
  {
    FirstTime = FALSE;
   
    tInterfaceParameters.Channel                 = 0;
    tInterfaceParameters.ucSpeed                 = SERIAL_BAUD_19200;
    tInterfaceParameters.Rx_tx_sizes.RxQueueSize = RX_BUFFER_SIZE;
    tInterfaceParameters.Rx_tx_sizes.TxQueueSize = TX_BUFFER_SIZE;
    tInterfaceParameters.Task_to_wake            = TASK_RC531;
    tInterfaceParameters.usConfig                = (CHAR_8 | NO_PARITY | ONE_STOP | NO_HANDSHAKE | CHAR_MODE);
   
    SerialPortID0 = fnOpen(TYPE_TTY, FOR_I_O, &tInterfaceParameters);

    tInterfaceParameters.Channel                 = 1;
    tInterfaceParameters.ucSpeed                 = SERIAL_BAUD_19200;
    tInterfaceParameters.Rx_tx_sizes.RxQueueSize = RX_BUFFER_SIZE;
    tInterfaceParameters.Rx_tx_sizes.TxQueueSize = TX_BUFFER_SIZE;
    tInterfaceParameters.Task_to_wake            = TASK_RC531;
    tInterfaceParameters.usConfig                = (CHAR_8 | NO_PARITY | ONE_STOP | NO_HANDSHAKE | CHAR_MODE);
   
    SerialPortID1 = fnOpen(TYPE_TTY, FOR_I_O, &tInterfaceParameters);

    PANPAR = 0;                                                         // return all ADC inputs to GPIO
    DDRAN &= ~PORT_AN_BIT0;                                             // set up direction for opto input
    DDRLD |= PORT_LD_BIT4;                                         // set up direction for opto output
    OPTO_ON();                                                          // needs 1ms to be detected
       
    interrupt_setup.int_type       = PORT_INTERRUPT;                    // identifier when configuring {25} - always initialise
    interrupt_setup.int_handler    = RC531_IRQ_OnInterrupt;             // handling function
    interrupt_setup.int_priority   = (INTERRUPT_LEVEL_1);               // interrupt priority level (this can not be modified for IRQ1..IRQ7 so the value is not really relevant)
    interrupt_setup.int_port_bit   = 1;                                 // The IRQ input connected
    interrupt_setup.int_port_sense = IRQ_RISING_EDGE;                   // Interrupt on this edge
    fnConfigureInterrupt((void *)&interrupt_setup);                     // configure test interrupt
   
    (void) OpenRC();                                                    // pins, speed & reset
    (void) Mf500PcdConfig(); 
    (void) Mf500PcdSetDefaultAttrib();
  }
   
  if (!Q_OPTO())
  {
    lamps (GREEN, OFF);
    lamps (RED, ON);
   
    return;
  }
 
  OpenCard();
 
  receive = ReadCard();
 
  if (receive == MI_OK)
  {
    lamps (GREEN, ON);
    lamps (RED, OFF);
  }
  else
  {
    lamps (GREEN, OFF);
    lamps (RED, ON);
  }
 
  // the output of port 0 is wired to the input of port 1 and vice versa
 
  ucRx[0] = 'A';                                      // send out an 'A'
  ucLength = fnWrite(SerialPortID1, ucRx, 1);         // on port 1
  ucLength = fnRead (SerialPortID0, ucRx, 1);         // read it back from port 0
  ucRx[0] += 1;                                       // make it a 'B'
  ucLength = fnWrite(SerialPortID0, ucRx, 1);         // send it on port 0
  ucLength = fnRead (SerialPortID1, ucRx, 1);         // read it back on port 1
 
 

//  uTaskerStateChange(TASK_RC531, UTASKER_SUSPENDED);  // run task only once for now
 
  return;
}

Another weird one.
Thanks,
Ewan.

7
NXPTM M522XX, KINETIS and i.MX RT / More SPI issues
« on: November 03, 2008, 10:00:25 PM »
I have the SPI where I can read and write to a periperal without error when I do a couple of reads and writes then have a breakpoint to check the results. When I let the program run, it gets stuck in the while loop (see below).
Code: [Select]
// Write one byte to the reader IC address space
/*!
* -o  address  (IN) reader ic register address
* -o  value    (IN) 8 bit value
* return: none
*
* Function for writting one char to the reader module
*
*/

void WriteRawRC(unsigned char addr, unsigned char value)
{
  addr <<= 1;
  addr &= ~0x81;                              // fix up addr

  _CLEARBITS(AS, PORT_AS_BIT3);               // lower cs
 
  QIR = 0xd00f;                               // reset errors
  QAR = QSPI_COMMAND_RAM_0;                   // set address to first command location
  QDR = 0x0f00;                               // command to use no cs
  QDR = 0x0f00;                               // command to use no cs
  QAR = QSPI_TRANSMIT_RAM_0;                  // set address to first transmit location
  QDR = addr;                                 // save it
  QDR = value;                                // save it
  QWR = QSPI_CSIV | 0x100;                    // two sends
  QDLYR = QSPI_SPE;                           // QSPI enable (start)

  while (!(QIR & QSPI_SPIF)) {}               // wait for transfer to complete [stuck here]
  QIR |= QSPI_SPIF;                           // reset SPIF et al.

  _SETBITS(AS, PORT_AS_BIT3);                 // raise cs
}
The funny thing is that when I add a variable to it {test = QIR;} to test the loop, QIR equals 1 but the while loop continues anyway. Also the CS line has already been released. I cannot fathom how this is possible from several points of view. Does anyone have any ideas about this? When I disable the part of the program which deals with this stuff the ethernet/HTTP etc. works fine.

8
NXPTM M522XX, KINETIS and i.MX RT / IRQ1 problems
« on: November 01, 2008, 07:12:50 PM »
I have an SPI device with which I can communicate properly. It returns an interrupt (rising edge) which is connected to IRQ1 in the 80 pin package. The code is
Code: [Select]
void fnRC531 (TTASKTABLE *)
{
  volatile unsigned char          result, result2;
  static char                     FirstTime = TRUE;
  INTERRUPT_SETUP                 interrupt_setup;
 
  if (FirstTime == TRUE)
  {
    FirstTime = FALSE;

    interrupt_setup.int_type     = PORT_INTERRUPT;                       // identifier when configuring {25} - always initialise
    interrupt_setup.int_handler  = RC531_IRQ_OnInterrupt;                // handling function
    interrupt_setup.int_priority = (INTERRUPT_LEVEL_1);                  // interrupt priority level (this can not be modified for IRQ1..IRQ7 so the value is not really relevant)
    interrupt_setup.int_port_bit = 1;                                    // The IRQ input connected
    interrupt_setup.int_port_sense = IRQ_RISING_EDGE;                    // Interrupt on this edge
    fnConfigureInterrupt((void *)&interrupt_setup);                      // configure test interrupt
  }
 
  OpenCard();
 
  ReadCard();
 
  uTaskerStateChange(TASK_RC531, UTASKER_SUSPENDED);  // run task only once for now
}
I have a breakpoint set as follows
Code: [Select]
/*
** ===================================================================
**     Event       :  RC531_IRQ_OnInterrupt (module Events)
**
**     Description :
**         This event is called when an active signal edge/level has
**         occurred.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void RC531_IRQ_OnInterrupt(void)
{
  RC531_IRQ_Disable();         // <--- the breakpoint is at the start of this line
  uEnable_Interrupt();
  SingleResponseIsr();
  RC531_IRQ_Enable();
}
When I run the program it never reaches the breakpoint. Instead it goes here
Code: [Select]
// default interrupt handler - and undefined interrupts will arrive here
//
static __interrupt__ void undef_int(void)
{
    while (1) {}                                                         // wait here and analyse with debugger....
}
If I comment out the interrupt_setup stuff the program does not work, of course, but I don't get the bum interrupt.
Where am I making a mistake?

Regards,

Ewan.

9
FreescaleTM MC9S12NE64 / No memory from 0x8000 to 0xbfff
« on: October 16, 2008, 07:12:30 PM »
I cannot seem to get the linker to understand that there really is memory at 0x8000. I have tried both small and banked models. If I use the "Processor Expert" in the Metrowerks Code Warrior, it will not allow it either. The .PRM file seems to have the correct entries. This has to be something really easy but i'll be darned if I can see it.

Thanks.

10
FreescaleTM MC9S12NE64 / First go at a compilation
« on: October 12, 2008, 09:58:54 PM »
I downloaded the NE64 files then overwrote them with SP1. When I compile using CodeWarrior I get an error in "webinterface.c" which complains at line 56 "UPLOAD_FAILED not declared". If I comment this out it goes on to more errors. Upon searching for this definition I find it is in files for the MCF52233, specifically in "app_hw_m5223x.h", but nowhere to do with the NE64.

What am I doing wrong?

Thanks.

11
µTasker general / Server has fixed IP and MAC address. Do I need ARP?
« on: March 07, 2008, 08:47:06 PM »
I have about 500 clients on a network with one server. The server's MAC address and IP address are  fixed and known. Is there a way to have this information permanently in the ARP cache or otherwise avoid the ARP messages? The clients never talk to each other.

Thanks,

Ewan.

12
µTasker general / SPI in the simulator
« on: March 07, 2008, 02:15:53 AM »
I am using the M52233DEMO board configuration in VS 6.0 and was trying to simulate an SPI chip. I have the latest download with SP6 installed including renaming the "config_ref_m5223X_sp6.h" file to "config.h".

I used the "Configuration example" in the "uFileSystem in SPI FLASH" application note. The symptom is that while I get the correct 1MByte file with some stuff in it, it is incorrect. For example I have 10 files named E.htm to N.htm with sizes from 32KBytes to 138KBytes for a total of 621KBytes. Using IE v6.0.2800 I contact the device using ftp. I then drag and drop the files to the ftp window. All seems well. The IE window shows all the files. When I press "F5" to refresh, however, there are typically only two files there. Upon inspection, the AT45DBXXX.ini file is mostly populated with 0xff bytes.

Any clues?

Thanks,

Ewan.

13
µTasker general / How are concurrent task starts handled?
« on: March 01, 2008, 07:30:27 PM »
If there are three tasks and one is running, and the other two tasks are scheduled (using o.s. timers) to start before the first is complete, which task starts next, and when?

What happens during "idle" time?

I have looked at the literature and the various posts and still have trouble visualizing the scheduler process. I do understand one-shot timers.

Thanks,

Ewan.

Pages: [1]