cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with Getting started with the STM32L152D-EVAL

spveer
Associate II
Posted on October 13, 2014 at 06:12

Dear all,

I started to work on a STM32L152D-EVAL board.

While I started to play around, I tried the demonstration firmware from the following link:

http://www.st.com/web/en/catalog/tools/PF257910

I am using the IAR Compiler with I-Jet debugger.

I am able to flash the board with new firmware, however nothing is showing up on the lcd, neither something happens when i press the joy stick as demonstrated.

I thought the demonstration firmware should run out of the box. Am I missing something here?

 

In particular I need examples related to the SPI interface for this board. Can someone please point me to the right samples for SPI on this board, which may work out of the box, so that I can then further customize the samples based on my needs?

Thanks a lot.

Regards,

Pradeep

#stm32l152d-eval-demonstratio-spi
14 REPLIES 14
Posted on October 13, 2014 at 15:14

http://www.st.com/web/en/catalog/tools/PF257913#

STM32L1xx_StdPeriph_Lib_V1.3.0\Project\STM32L1xx_StdPeriph_Examples\SPI\SPI_TwoBoards\DataExchangeDMA\readme.txt
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
spveer
Associate II
Posted on October 14, 2014 at 15:07

Thanks Clive for the infos.

I need some more help.

I have noticed a strange issue with the board.

I configured the joystick... right button on PG7,  left button on PG6 and so on.

The joy stick responded.

Without any change in the software or hardware, I tried after sometime, but this time the joy stick did not respond.

Later after a few hours when I tried it again responded and later again not.

Can someone guess what could be the reason, may be I am missing some concepts here.

Thanks a lot for your input.

Regards

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

/**

 * @brief Joystick Right push-button

 */

#define RIGHT_BUTTON_PIN                 GPIO_Pin_7

#define RIGHT_BUTTON_GPIO_PORT           GPIOG

#define RIGHT_BUTTON_GPIO_CLK            RCC_AHBPeriph_GPIOG

#define RIGHT_BUTTON_EXTI_LINE           EXTI_Line7

#define RIGHT_BUTTON_EXTI_PORT_SOURCE    EXTI_PortSourceGPIOG

#define RIGHT_BUTTON_EXTI_PIN_SOURCE     EXTI_PinSource7

#define RIGHT_BUTTON_EXTI_IRQn           EXTI15_10_IRQn

/**

 * @brief Joystick Left push-button

 */

#define LEFT_BUTTON_PIN                  GPIO_Pin_6

#define LEFT_BUTTON_GPIO_PORT            GPIOG

#define LEFT_BUTTON_GPIO_CLK             RCC_AHBPeriph_GPIOG

#define LEFT_BUTTON_EXTI_LINE            EXTI_Line6

#define LEFT_BUTTON_EXTI_PORT_SOURCE     EXTI_PortSourceGPIOG

#define LEFT_BUTTON_EXTI_PIN_SOURCE      EXTI_PinSource6

#define LEFT_BUTTON_EXTI_IRQn            EXTI15_10_IRQn  

/**

 * @brief Joystick Up push-button

 */

#define UP_BUTTON_PIN                    GPIO_Pin_11

#define UP_BUTTON_GPIO_PORT              GPIOG

#define UP_BUTTON_GPIO_CLK               RCC_AHBPeriph_GPIOG

#define UP_BUTTON_EXTI_LINE              EXTI_Line11

#define UP_BUTTON_EXTI_PORT_SOURCE       EXTI_PortSourceGPIOG

#define UP_BUTTON_EXTI_PIN_SOURCE        EXTI_PinSource11

#define UP_BUTTON_EXTI_IRQn              EXTI9_5_IRQn

/**

 * @brief Joystick Down push-button

 */  

#define DOWN_BUTTON_PIN                  GPIO_Pin_8

#define DOWN_BUTTON_GPIO_PORT            GPIOG

#define DOWN_BUTTON_GPIO_CLK             RCC_AHBPeriph_GPIOG

#define DOWN_BUTTON_EXTI_LINE            EXTI_Line8

#define DOWN_BUTTON_EXTI_PORT_SOURCE     EXTI_PortSourceGPIOG

#define DOWN_BUTTON_EXTI_PIN_SOURCE      EXTI_PinSource8

#define DOWN_BUTTON_EXTI_IRQn            EXTI15_10_IRQn  

/**

 * @brief Joystick Sel push-button

 */

#define SEL_BUTTON_PIN                   GPIO_Pin_13

#define SEL_BUTTON_GPIO_PORT             GPIOG

#define SEL_BUTTON_GPIO_CLK              RCC_AHBPeriph_GPIOG

#define SEL_BUTTON_EXTI_LINE             EXTI_Line13

#define SEL_BUTTON_EXTI_PORT_SOURCE      EXTI_PortSourceGPIOG

#define SEL_BUTTON_EXTI_PIN_SOURCE       EXTI_PinSource13

#define SEL_BUTTON_EXTI_IRQn             EXTI9_5_IRQn

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

    PressedButton = Read_Joystick();

    

    while (PressedButton == JOY_NONE)

    {

      PressedButton = Read_Joystick();

    }

       

    switch (PressedButton)

    {

      /* JOY_RIGHT button pressed */

      case JOY_RIGHT:

        CmdTransmitted = CMD_RIGHT;

        NumberOfByte = CMD_RIGHT_SIZE;

        break;

      /* JOY_LEFT button pressed */

      case JOY_LEFT:

        CmdTransmitted = CMD_LEFT;

        NumberOfByte = CMD_LEFT_SIZE;

        break;

      /* JOY_UP button pressed */

      case JOY_UP:

        CmdTransmitted = CMD_UP;

        NumberOfByte = CMD_UP_SIZE;

        break;

      /* JOY_DOWN button pressed */

      case JOY_DOWN:

        CmdTransmitted = CMD_DOWN;

        NumberOfByte = CMD_DOWN_SIZE;

        break;

      /* JOY_SEL button pressed */

      case JOY_SEL:

        CmdTransmitted = CMD_SEL;

        NumberOfByte = CMD_SEL_SIZE;

        break;

      default:

        break;

    }

Posted on October 14, 2014 at 16:27

I don't have this board.

You do appear however to be confused about what EXTI interrupts are generated, there is a one-on-one association between the pin# and exti#, and thus the range of EXTI IRQ Handler it will be directed too. ie 7 isn't in the 10 to 15 bucket
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
spveer
Associate II
Posted on October 14, 2014 at 16:42

I corrected these EXTI values based on the link you have given me already (see below):

Still the joy stick is not responding!

In general where is this pin-exti relationship documented? I couldnt find anything in the processor's datasheet.

Anyway I believe the below definitions are now correct. I am simply using the sample code with no modifications.

Thanks again.

#define BUTTONn                          6

/* On STM32L152D-EVAL board, the KEY button is connected to PA.00 and it can

   be use as Wakeup pin button. */

/**

 * @brief Key push-button

 */

#define KEY_BUTTON_PIN                   GPIO_Pin_0

#define KEY_BUTTON_GPIO_PORT             GPIOA

#define KEY_BUTTON_GPIO_CLK              RCC_AHBPeriph_GPIOA

#define KEY_BUTTON_EXTI_LINE             EXTI_Line0

#define KEY_BUTTON_EXTI_PORT_SOURCE      EXTI_PortSourceGPIOA

#define KEY_BUTTON_EXTI_PIN_SOURCE       EXTI_PinSource0

#define KEY_BUTTON_EXTI_IRQn             EXTI0_IRQn

/**

 * @brief Joystick Right push-button

 */

#define RIGHT_BUTTON_PIN                 GPIO_Pin_7

#define RIGHT_BUTTON_GPIO_PORT           GPIOG

#define RIGHT_BUTTON_GPIO_CLK            RCC_AHBPeriph_GPIOG

#define RIGHT_BUTTON_EXTI_LINE           EXTI_Line7

#define RIGHT_BUTTON_EXTI_PORT_SOURCE    EXTI_PortSourceGPIOG

#define RIGHT_BUTTON_EXTI_PIN_SOURCE     EXTI_PinSource7

#define RIGHT_BUTTON_EXTI_IRQn           EXTI9_5_IRQn

/**

 * @brief Joystick Left push-button

 */    

#define LEFT_BUTTON_PIN                  GPIO_Pin_6

#define LEFT_BUTTON_GPIO_PORT            GPIOG

#define LEFT_BUTTON_GPIO_CLK             RCC_AHBPeriph_GPIOG

#define LEFT_BUTTON_EXTI_LINE            EXTI_Line6

#define LEFT_BUTTON_EXTI_PORT_SOURCE     EXTI_PortSourceGPIOG

#define LEFT_BUTTON_EXTI_PIN_SOURCE      EXTI_PinSource6

#define LEFT_BUTTON_EXTI_IRQn            EXTI9_5_IRQn  

/**

 * @brief Joystick Up push-button

 */

#define UP_BUTTON_PIN                    GPIO_Pin_11

#define UP_BUTTON_GPIO_PORT              GPIOG

#define UP_BUTTON_GPIO_CLK               RCC_AHBPeriph_GPIOG

#define UP_BUTTON_EXTI_LINE              EXTI_Line11

#define UP_BUTTON_EXTI_PORT_SOURCE       EXTI_PortSourceGPIOG

#define UP_BUTTON_EXTI_PIN_SOURCE        EXTI_PinSource11

#define UP_BUTTON_EXTI_IRQn              EXTI15_10_IRQn  

/**

 * @brief Joystick Down push-button

 */   

#define DOWN_BUTTON_PIN                  GPIO_Pin_8

#define DOWN_BUTTON_GPIO_PORT            GPIOG

#define DOWN_BUTTON_GPIO_CLK             RCC_AHBPeriph_GPIOG

#define DOWN_BUTTON_EXTI_LINE            EXTI_Line8

#define DOWN_BUTTON_EXTI_PORT_SOURCE     EXTI_PortSourceGPIOG

#define DOWN_BUTTON_EXTI_PIN_SOURCE      EXTI_PinSource8

#define DOWN_BUTTON_EXTI_IRQn            EXTI9_5_IRQn  

/**

 * @brief Joystick Sel push-button

 */  

#define SEL_BUTTON_PIN                   GPIO_Pin_13

#define SEL_BUTTON_GPIO_PORT             GPIOG

#define SEL_BUTTON_GPIO_CLK              RCC_AHBPeriph_GPIOG

#define SEL_BUTTON_EXTI_LINE             EXTI_Line13

#define SEL_BUTTON_EXTI_PORT_SOURCE      EXTI_PortSourceGPIOG

#define SEL_BUTTON_EXTI_PIN_SOURCE       EXTI_PinSource13

#define SEL_BUTTON_EXTI_IRQn             EXTI15_10_IRQn  

Posted on October 14, 2014 at 18:05

You'd want the Reference Manual (RM0038), look at SYSCFG_EXTICR1, also ''Figure 30 External interrupt/event GPIO mapping'', this was Revision 8 of the manual, in others search the title.

Your code will also need the respective IRQ Handlers to qualify and clear the interrupts and EXTI pins
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on October 14, 2014 at 18:08

http://www.st.com/web/en/resource/technical/document/reference_manual/CD00240193.pdf

Figure 33, page 237
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
spveer
Associate II
Posted on October 15, 2014 at 11:01

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6oE&d=%2Fa%2F0X0000000bvw%2Fec1JxK4TbLIrLxWPi_9BQMFFqhkbVNmynEJAcImKCpg&asPdf=false
Posted on October 15, 2014 at 13:08

The SPI clock will only output when you are sending data, suggest you do so in a continuous loop so you can see it on a scope.

I don't know if there are any pin clashes on the board that might preclude the use of the pins in question.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
spveer
Associate II
Posted on October 15, 2014 at 13:41

Do you mean the spi configuration is reasonably correct the way I used it?

I moved the

spix_send_receive

() function into the main's endless while loop, but it did not help. I still cannot see any signal on SCK!

Also I cross checked the board for pin clashes.

Is there any other suggestion that you can give me?

STM32 is the SPI-master on which I am currently working. I have a test-board as SPI-Slave, and it is to be tested as part of this exercise, if the test-board is working correctly.

Is it important that I have the spi slave connected to see on the scope MOSI, SCK signals sent from Master?

Or asked the other way, Can I test my SPI-Master configuration and functionality without having the SPI-Slave connected?

Thanks a lot.

Regards