2014-10-12 09:12 PM
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
2014-10-13 06:14 AM
http://www.st.com/web/en/catalog/tools/PF257913#
STM32L1xx_StdPeriph_Lib_V1.3.0\Project\STM32L1xx_StdPeriph_Examples\SPI\SPI_TwoBoards\DataExchangeDMA\readme.txt2014-10-14 06:07 AM
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; }2014-10-14 07:27 AM
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 bucket2014-10-14 07:42 AM
#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_IRQn2014-10-14 09:05 AM
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 pins2014-10-14 09:08 AM
http://www.st.com/web/en/resource/technical/document/reference_manual/CD00240193.pdf
Figure 33, page 2372014-10-15 02:01 AM
2014-10-15 04:08 AM
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.2014-10-15 04:41 AM
Do you mean the spi configuration is reasonably correct the way I used it?
I moved thespix_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