Flyline

Members
  • Content Count

    16
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Flyline got a reaction from JColvin in interfacing PmodCLS with an arduino   
    I believe I found the issue with the PmodLCS and the SPI interface..  I was using a 1 second time delay function that reads the core timer using the code in Listing 1. After 107 seconds, this polling delay would suddenly cut short my delays thus blasting an number of LCD SPI packets in a very short interval. Even though the delay function would eventually recover, the LCD operation was compromised causing the LCD to go blank. 
    It is no coincident that the maximum delay using the delay code in Listing 2 below is 107.374 seconds. (2^32/40,000,000 = 107.374).  But this limitation does not explain the failure of Listing 1 since I was only delaying 1000 ms or 40,000,000 core timer ticks. I believe that the problem lies in my understanding of how the XC32 compiler implements the unsigned magnitude compare embedded in the while statement.
    Listing 1.  Bad polling delay function
    void DelayMs(unsigned int mS)
    {
    // CORE_MS_TICK_RATE = core timer frequency / 1000 or 40,000,000/1000
    unsigned int tWait;
        tWait = (CORE_MS_TICK_RATE * mS) + ReadCoreTimer();
        while(ReadCoreTimer() < tWait); /* wait for the time to pass */
    } /* End of DelayMs */
    Listing 2.  Good polling delay function - 107 seconds maximum
    void DelayMs(unsigned int mS)
    {
    // CORE_MS_TICK_RATE = core timer frequency / 1000 or 40,000,000/1000
    unsigned int tWait, tStart;
        tStart = ReadCoreTimer();
        tWait = (CORE_MS_TICK_RATE * mS);
        while((ReadCoreTimer()- tStart) < tWait); /* wait for the time to pass */
    } /* End of DelayMs */
     
  2. Like
    Flyline got a reaction from JColvin in interfacing PmodCLS with an arduino   
    I have been working with the PmodCLS and have completed designs for all three serial interfaces/  I used the mpide code downloaded from https://reference.digilentinc.com/_media/reference/pmod/pmodcls/pmodcls-mpide-lib.zip. The function to clear the display and home the cursor shown below appears to have an error. According to the Instruction set found at https://reference.digilentinc.com/pmod/pmod/cls/user_guide, the array should not contain the '0' character. The string should be: "uint8_t dispClr[] = {ESC, BRACKET, DISP_CLR_CMD};"   
    void LCDS::DisplayClear() {
        uint8_t dispClr[] = {ESC, BRACKET, '0', DISP_CLR_CMD};
        //clear the display and returns the cursor home
        SendBytes(dispClr, 4);    // After changing the text string, the "4" in this line should be changed to "3"
    }
    Since the example code is only for the SPI interface, be sure that JP1 is in the "SS" position so the device select operates correctly.
    I developed three test projects using the MPLAB X IDE (not Arduino). I used the same test code that displays a count that is incremented once a second for for all three serial interfaces.  I left the UART and I2C test programs run over night resulting in over 30000 seconds. When I run the SPI interface, the LCD goes blank after 107 seconds even though the PIC32 continues to send SPI data.  This failure is independent on what else is being displayed.  This is a curious failure mode.  
    I am wondering if anyone else has encountered this problem.  I can supply my test projects upon request but the code is written for a PIC32MX370 processor which is a PPS device.
     
     
  3. Like
    Flyline got a reaction from MT in Arduino IDE vs MPIDE, chipkit-core   
    I have successfully tested the attached sketch on a chipKIT PRO MX7 using Arduino 1.6.8 and the PIC core release 1.1.0 (See http://chipkit.net/chipkit-core-is-released-for-use-in-arduino-ide/). I have modified the attached Blink sketch to test the mapping of the board LEDs and test the serial port.
    Yes, you are using the correct serial port.  
    1. Make sure that you ave programmed the chipKIT PRO MX7 with the "chipKIT_Bootloader_MX7ck" using MPLAB X. The boot loader is available on the Digilent web site. I have also attached the hex file below. To program the bootloader with MPLAB X, you will need to attach the PC to the DEBUG USB port.  After programming the bootloader, you will no longer need to be attached to the DEBUG USB port.
    2. Make sure you have JP11 shorted and R159 removed (See pdf file below).
    3. Before attempting to load a sketch, hold BTN1 down while pressing the reset button. If the chipKIT Pro MX7 is reset and ready to download a file, LED1 on the processor board will flash about 4 times per second.
    4. This sketch sets the UART for 38.4KB - Make sure you set the serial monitor for 38400.
    Blink.ino
    chipKIT R159.pdf
    chipKIT_Bootloader_MX7ck.zip
  4. Like
    Flyline got a reaction from JColvin in Arduino IDE vs MPIDE, chipkit-core   
    I have successfully tested the attached sketch on a chipKIT PRO MX7 using Arduino 1.6.8 and the PIC core release 1.1.0 (See http://chipkit.net/chipkit-core-is-released-for-use-in-arduino-ide/). I have modified the attached Blink sketch to test the mapping of the board LEDs and test the serial port.
    Yes, you are using the correct serial port.  
    1. Make sure that you ave programmed the chipKIT PRO MX7 with the "chipKIT_Bootloader_MX7ck" using MPLAB X. The boot loader is available on the Digilent web site. I have also attached the hex file below. To program the bootloader with MPLAB X, you will need to attach the PC to the DEBUG USB port.  After programming the bootloader, you will no longer need to be attached to the DEBUG USB port.
    2. Make sure you have JP11 shorted and R159 removed (See pdf file below).
    3. Before attempting to load a sketch, hold BTN1 down while pressing the reset button. If the chipKIT Pro MX7 is reset and ready to download a file, LED1 on the processor board will flash about 4 times per second.
    4. This sketch sets the UART for 38.4KB - Make sure you set the serial monitor for 38400.
    Blink.ino
    chipKIT R159.pdf
    chipKIT_Bootloader_MX7ck.zip
  5. Like
    Flyline got a reaction from JColvin in Pmod Shield-Uno with WF32 and WiFire   
    As I work with the chipKIT WF32 and the WiFIre, I find that making external connections to these processor boards is not as convenient as they are for the chipKIT Pro MX7 that has Pmod connectors JA through JF.  Additionally there are limited pins for taking 3.3V/5V and ground off board.  I can only assume that these chipKIT boards were always intended to be used with a shield of some sort. If Digilent makes IO shields specifically for the WF32 and WiFire, please advise. 
    Meanwhile, I find the the Pmod Shield-Uno can be used to provide standard Pmod connections provided a few modifications are made. 
    1. The bottom side female connectors for JP6-JP8 must be removed because the USB connector J13 on the Wf32 and WiFire are in the way.  This is easily done by gently bending the female connectors on the bottom of the Shield-Uno back and forth until they break off at the surface of the PCB. The schematic diagram for the Pmod-Shield does not show a connection for the center pin of JP6 and JP8.  Can I assume that since JP6 and JP8 do not feed through to the WF32 or the WiFire that A04/A18 and A05/A19 are not functional?
    2. I observed that pins 1 and 2 of J3 on the WF32 / WiFire have no connection to J5 on the Pmod-SHield. This appears not to be an issue since J3:1 is not connected and J3:2 has jumper to J3:4.  
    3 J6 of the WF32 / WiFire has no connection to the Pmod-Shield making connections to I2C2 unavailable. I could not find a secondary connection for SCL2 and SDA2.
    4. Although the majority of the processor programming is done in the Arduino IDE environment using the serial port, there are times that debugging with the MPLAB X IDE is beneficial. Hence, I permanently soldered a single row right angle 6 pin header in JP2.  This allows me to slip on and off a chipKIT programmer without removing the shield. Do you for see any problems such as RFI emissions?   
    5. Reading through the Pmod Shield-Uno users manual I see that the signal names for JA and JB are the same. The chipKIT pin numbers appear to be correct. Digilent should update the users manual.
  6. Like
    Flyline got a reaction from JColvin in Arduino IDE vs MPIDE, chipkit-core   
    James,
    I finished the Hen House project using a Core build that hasn't been released yet.  For once I am ahead of the tools. I have been working with Keith and he may know when the Core build will be released.  Now it is on to the WiFire. I may stop by tomorrow and give you a demo.
    Richard