This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Implement a Joystick click and 8x8 Y click

Other Parts Discussed in Thread: BOOSTXL-EDUMKII, TM4C1294NCPDT

I have to iplement a program with the microcontroller, a joystick click and a 8x8 y click. For example showing letters (alphabet), if you go left it goes backwards, up and down for switching between uppercase letters and lower case letters.

My problem is, that i do not know how to adress the to booster packs with the joystick and the 8x8 y click..

I have until now nothing, so i am glad about every help, suggestion, etc..

thanks!

Babsi

  • Hello Barbara,

    I assume you are talking about the Educational BooserPack MKII (BOOSTXL-EDUMKII)? If so, more information for it can be found here www.ti.com/.../boostxl-edumkii.

    Unfortunately, I do not understand what you mean by 8x8 y click so I can't offer any pointers with that. I also do not know what you mean when you state you don't know how to "address" the booster packs? Do you mean you don't know how to communicate with it or simply you have no idea where to start with it? i.e., I am confused by your use of the word "address" in this context. Do you mean address as in CPU readable address or do you address as in to address an issue/problem?

    The first step is to insure that the booster pack connectors for the booster pack and the launchpad you intend to use matchup since some features may not be available on all launchpads.

    The second part would be to see what inputs are needed for the specific functions you wish to implement. As an example, the horizontal and vertical outputs from the boosterpack are mapped to analog inputs on the MCU launchpad. This means you will need to initialize and use the ADC to determine which direction the joystick is being asserted. The joystick click is a single digital input so it is simply the assertion of a GPIO but you will likely want to use some method of debouncing this input.

    Hopefully this gives you enough information to get you on your way. Comeback to the forum to post new threads if you run into specific issues with, for example, the ADC configuration and use.
  • Hello Chuck,

    thanks for your response!

    i have a TI Connected Launchpad with a TM4C1294NCPDT Cortex M4 Mikrocontroller.
    the 8x8 y click is a LED Matrix: www.mikroe.com/.../

    I mean, that I do not know how to communicate with it & how to start with it, like which pins i have to set, etc..

    Do you have example codes or websides where i can get informations to getting started with it? as an support?

    Thanks & regars,

    Barbara
  • Barbara,

    Sorry for the confusion. I get it now. These 'click' devices are add on modules similar to our boosterpacks. They have a common connector interface used for integrating the add-ons to the EVM.

    To start, you would need to determine which of the pins on the interface the add-on board uses. This document describes how to interpret the pinout of each board: download.mikroe.com/.../mikrobus-standard-specification-v200.pdf

    Generally speaking, the advice remains the same. Review the documentation on the respective web pages to understand the interface tot he module/board. Determine which pins you will need to use on the TM4C LP and connect as appropriate. I would suggest the use of some form of prototyping board or breadboard since the Boosterpack connectors are almost certainly not compatible to the standard click interface.

    As far as examples, I see links on the click web pages for examples. Towards the lower third of the page it lists which specific devices the examples are written for and I see " EasyMx PRO v7 for Stellaris(R) - LM3S9B95, LM4F232H5QD" which are predecessors of the Tiva devices and should port fairly easily to TM4C129 launchpad (especially the LM4F232 device). Note that the 8x8 Y display uses a SPI interface to send configuration and ascii data to the display. I'm not certain if their example will have all of the library or not. Perhaps they may have someone you can discuss support with as well.

    Hopefully this helps get you started. As I said before come back if you have additional questions or specific questions on the TM4C modules. We will help as much as we can.
  • Let the record show that, "NO/ZERO" LM4F devices were (ever) produced for the general market!   Instead each/every "M4" device my firm ordered & received (multiple, different devices) carried the (lesser) LX4F nomenclature - which was described as, "Not quite ready for prime-time."  

    It is these LX4F devices which are the (real) predecessors of your newer - TM4C123 MCUs.

    I must disagree w/the statement, "...LM4F232H5QD" which are predecessors of the Tiva devices and should port fairly easily to TM4C129 launchpad (especially the LM4F232 device).   Is not the 4C129 markedly different from the 4C123?  (especially so the 4C129's I2C peripheral)   It is the 4C123 series which has the best chance of "crossing" to (past/dispatched) LX4F! 

    I'd be (most) surprised if (any) 4C129 is listed as the (selected/optimal "equivalent device") for ANY (past) LX4F device...

  • cb,

    The point was that there are examples for Stellaris/Tiva based parts that follow similar SW flows and use similar APIs as used in TivaWare. These examples should provide a good base for understanding how to implement the software side of the project for the given HW.
  • Chuck,

    Indeed - but somehow you felt obliged to add (past) compatibility information - and as stated - I believe that advice was wrong! Are we to remain silent when (vendor's) advice is incorrect?
  • cb,

    I never mentioned compatibility; I simply mentioned porting the SW to TM4C129. None the less, the discussion adds valuable information for the person doing the port to look for potential incompatibilities and proceed with caution. Thanks for the contribution to the discussion!

    Note, even though I am a representative of the "vendor" as you so frequently mention, I am human and prone to mistake based on my level of experience and understanding as much as you or anyone else in this forum. If I provide inadequate or incorrect information, you are more than welcome to redirect, enhance, or correct as necessary. All in all, I would surmise that you have far more experience with this product line than I and can offer advice from a non-partisan, customer view point which is beneficial in this forum.

    With that said, I don't think my advice was incorrect.
  • We must then, "agree to disagree" re: "migrate from LX4F to TM4C129. (as your writing advised)

    My belief - being a 5K+ client-user of (past/discarded) LX4F:  TM4C129 is substantially different from the TM4C123.  (more complex)  

    Thus the TM4C123 provides a much more, "Likely to succeed" migration path (due to its "far better matching") of performance/features to poster's LM3S or LX4F (past) device.

    The TM4C129 is far higher in cost as well - thus seems to "lose" on ALL fronts...   (and we note that no justification for 4C129's "recommendation" appeared...)

  • Hello,

    i have now this code (below), and it the LEDs are working, but they just are blinking sometimes and so on.. I am doing something wrong?

    And can you give me maybe a hint how i can work on just switch on special LEDs? For example to show a letter or just a row?

    Thanks and regars,

    Barbara

    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_ints.h"
    #include "inc/hw_memmap.h"
    #include "driverlib/debug.h"
    #include "driverlib/gpio.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom.h"
    #include "driverlib/rom_map.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/ssi.h" // Driver library for SPI peripheral
    #include "driverlib/uart.h"
    #include "eight_x_eight_font.h"

    uint32_t g_ui32SysClock;

    void Init(void)
    {
    g_ui32SysClock = SysCtlClockFreqSet(( SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);

    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
    GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    IntMasterEnable();
    GPIOPinConfigure(GPIO_PA0_U0RX);
    GPIOPinConfigure(GPIO_PA1_U0TX);
    GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    UARTConfigSetExpClk(UART0_BASE, g_ui32SysClock, 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));

    IntEnable(INT_UART0);
    UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
    }

    void InitSpi (void)
    {

    SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3); // Enable the peripheral "SSI3" (SPI3).

    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_SSI3)){
    }

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ); // Enable Port where the pins are allocated from "SSI3" (Port Q)

    GPIOPinConfigure(GPIO_PQ0_SSI3CLK);
    GPIOPinConfigure(GPIO_PQ3_SSI3XDAT1);
    GPIOPinConfigure(GPIO_PQ2_SSI3XDAT0);
    GPIOPinTypeSSI(GPIO_PORTQ_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_0);

    SSIConfigSetExpClk(SSI3_BASE, g_ui32SysClock, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 9000000, 16);
    SSIEnable(SSI3_BASE);
    }

    void InitMax7219 (void)
    {
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
    GPIOPinTypeGPIOOutput(GPIO_PORTP_BASE, GPIO_PIN_5);
    GPIOPinWrite(GPIO_PORTP_BASE, GPIO_PIN_5, GPIO_PIN_5);
    }

    void SpiSendRoutine (uint8_t data, uint8_t data2)
    {
    short combined = 0;
    combined = (data << 8) | (data2 & 0xff);

    //SSIDataPut(SSI3_BASE, data);
    //SysCtlDelay(100);
    SSIDataPut(SSI3_BASE, combined);
    //SysCtlDelay(100);
    GPIOPinWrite(GPIO_PORTP_BASE, GPIO_PIN_5, 0);
    //SysCtlDelay(100);
    GPIOPinWrite(GPIO_PORTP_BASE, GPIO_PIN_5, GPIO_PIN_5);
    }


    int getJoystick()
    {
    return 0;
    }


    void main()
    {
    int count = 65; // start with 'a'
    int upper = 0; //
    int brigth = 0; // brigthness of ouptut
    int someDelay = 100; //

    Init();
    InitSpi();
    InitMax7219();

    while(1)
    {
    int joy = getJoystick();
    switch(joy)
    {
    case 1: count++; break;
    case 2: count--; break;
    case 3: upper = 32; break;
    case 4: upper = 0; break;
    case 5: brigth++; break;
    default: break;
    }

    SpiSendRoutine(0x0B, 0xFF); //Scan Limit
    SpiSendRoutine(0x0A, 0x03); //Intensity
    SpiSendRoutine(0x09, 0x00);
    SpiSendRoutine(0x0C, 0x01);

    int i = 1;
    //for(i=1; i<=8; i++)
    //SpiSendRoutine(i, font[count+upper][i]);
    SpiSendRoutine(0x03, 0xFF);
    SpiSendRoutine(0x04, 0xFF);

    /*SpiSendRoutine(0x0F, 0x01);
    SysCtlDelay(10);
    SpiSendRoutine(0x0F, 0x00);
    SysCtlDelay(10);*/

    //SpiSendRoutine(0x0F, 0x00); //ausschalten Display Test
    //SpiSendRoutine(0x0F, 0x01); //einschalten Display Test


    SysCtlDelay(someDelay);
    }
    }

  • Hello Barbara,

    I believe the way that this board works is that you have to send some encoded information to it to display the leters. i.e., the matrix is 8X8 so you have to send it information pertaining to which column and which LED's within that column you wish to illuminate. I haven't dug deep enough to tell you specifically which values correspond to which letters, but you should be able to determine this by review of the examples.

    For example, int he mikrobasic examples for the LM4 device, it has a table of values to define the font 8x8 FONT.mbas . In this table the caracter '1' is represented by the string of values --  0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x40, 0x00,        ' Char 049 (1)' and if you draw out an 8x8 matrix you can similate the 8x8 LED matrix and reverse engineer the rows and columns the values correspond with.

    Such as  if we read the values from left to right with the left most being column 0 and the right most being column 7 and the upper LEDs being the MSbits and the lower being the LSbits. The matrix would look like this:

    0 0 0 0 0 0 0 0

    0 0 1 1 0 0 0 0

    0 1 1 1 0 0 0 0

    0 0 1 1 0 0 0 0

    0 0 1 1 0 0 0 0

    0 0 1 1 0 0 0 0

    0 0 1 1 0 0 0 0

    0 0 1 1 0 0 0 0

    Likewise, the string of values for the letter 'A' would be 0x00, 0x3E, 0x7E, 0xC8, 0xC8, 0x7E, 0x3E, 0x00,        ' Char 065 (A) as shown in the same table.

    Remember, though, before sending each column value you would need to provide the offset for the column as well as shown in the example.

    Hope this makes since.

  • Hello,

    thank you, now the LED is no problem anymore.

    But with the joystick ih have some:

    I initialized i2c, etc.. but in the datasheet there is written that i have to switch the joystick on (start up), but i do not how i can soft reset de Reg 0Fh [1] or how to enter the start up phase.

    best regards,

    babsi

  • Hello Barbara,

    There should be similar code examples for the Joystick showing the I2C message sequence to do this Joystic startup. Essentially you will have to send the address to the device/board over I2C then the Data to be written to the register. Have a look around the click website to see if you can locate the SW examples and, even if the SW is not directly portable, you should be able to see the sequence/data that is being send over I2C and if there are certain delays, expected responses, etc...