Archive

Posts Tagged ‘STM32’

IoT featured soccer table

August 24th, 2014 1 comment

IoT table from top

IoT table from top

Internet of Things (IoT) is one of the big electronics subjects throughout the world this year.

To show the capabilities of custom IoT devices and to help a local LAN-event organisation, TheBlast, we offered the help to create an Internet enabled soccer table.
Thanks to generous donation by Tuborg Fonden we were able to buy a brand new soccer table for us to modify.

We modified the table by adding two touch displays for user interaction, a barcode scanner for user registration. Inside the table we installed two score detection IR sensors and a ball release system, made by using a motor/wheel from an old Roomba robot. Finally we installed 5 meter of RGB LED strip to light up the playfield.

When scores is detected they are immediately registered online, to be displayed on the LAN-event website, where score timetable and all previous matches can be found.
This post will describe the features of the final table and how it was developed.


Read more…

Categories: ARM, STM32 Tags: , , , , , ,

STM32 Mini Computer

March 31st, 2010 28 comments

Hi again.
Today I’m going to talk about my mini computer I started making with the STM32.
It’s powered by the STM32F103RET6 stamp board from Futurlec, and it is clocked at 72MHz. Right now there isn’t any “real” applications or games in it, but theese are under development.

You can see some pictures about it here, but I’ve also made a video where you can see it in use.

Mini Computer - The Menu


The buttons on the right side of the menu is from Microchip’s Graphics Library, which I ported to the STM32.

httphd://www.youtube.com/watch?v=v3PYSW7yE4k

Edit, 29. September 2010:
I’ve now uploaded this source with some extra things like viewing images or playing MIDI or MP3 files (requires VS1053 chip) from SD card.
You can download the project here

Categories: ARM Tags: , , ,

STM32 Oscilloscope

February 18th, 2010 33 comments

This week I got some inspiration from the ST DSP library, so I made my own oscilloscope with the STM32 and my 320×240 pixels QTFT screen. I made the code from scratch, both the sampling and screen updating code – but I used the ST DSP library for the FFT calculations of course

You can see the video of the project here…
httphd://www.youtube.com/watch?v=llDmjxUtoRA

Due to the huge amount of requests I’ve decided to publish the code used in this project.
The code is a bit messy as it contains bits of code that is never reached – fx in the main() function.
As said above, the code uses the ST DSP Library to do the FFT calculations, and it just uses one of the ADC inputs for the sampling.

The code package can be downloaded here: STM32 Oscilloscope

Categories: ARM Tags: , ,

STM32 – Overclocking

February 14th, 2010 12 comments

Have you ever wondered if it was possible to overclock the STM32? It is, with a simple change in code line!
We only have to change the PLL setting, which is able to go up to 16 – so that means that we can overclock the STM32 up to 8MHz x 16 = 128 MHz
Here is the RCC Initialization code for 128MHz – remember, you also have to comment the “SYSCLK_FREQ_72MHz”, uncomment the “SYSCLK_FREQ_HSE” and set it to 128MHz in the system_stm32f10x.c

/*******************************************************************************
* Function Name  : RCC_Configuration
* Description    : Configures the different system clocks.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RCC_Configuration(void)
   {
   /* RCC system reset(for debug purpose) */
   RCC_DeInit();

   /* Enable HSE */
   RCC_HSEConfig(RCC_HSE_ON);

   /* Wait till HSE is ready */
   HSEStartUpStatus = RCC_WaitForHSEStartUp();

   if(HSEStartUpStatus == SUCCESS)
      {
      /* Enable Prefetch Buffer */
      FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);

      /* Flash 2 wait state */
      FLASH_SetLatency(FLASH_Latency_2);

      /* HCLK = SYSCLK */
      RCC_HCLKConfig(RCC_SYSCLK_Div1);

      /* PCLK2 = HCLK */
      RCC_PCLK2Config(RCC_HCLK_Div1);

      /* PCLK1 = HCLK/2 */
      RCC_PCLK1Config(RCC_HCLK_Div2);

      /* PLLCLK = 8MHz * 9 = 72 MHz */
      //RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
      /* PLLCLK = 8MHz * 16 = 128 MHz */
      RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_16);
      // The frequency has also been changed in system_stm32f10x

      /* Enable PLL */
      RCC_PLLCmd(ENABLE);

      /* Wait till PLL is ready */
      while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
         {;}

      /* Select PLL as system clock source */
      RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

      /* Wait till PLL is used as system clock source */
      while(RCC_GetSYSCLKSource() != 0x08)
         {;}
      }

   /* Enable peripheral clocks --------------------------------------------------*/
   /* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG and AFIO clocks */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC
         | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_GPIOF | RCC_APB2Periph_GPIOG
         | RCC_APB2Periph_AFIO, ENABLE);
   }
Categories: ARM Tags: , ,

STM32 – Internal 8MHz Clock Setup Routine

February 10th, 2010 6 comments

Here is the setup code to use the internal 8MHz clock – but with the internal clock, we are only able to get a max frequency of 36MHz.

void clock_init(){
  /*Configure all clocks to max for best performance.
   * If there are EMI, power, or noise problems, try slowing the clocks*/


  /* First set the flash latency to work with our clock*/
  /*000 Zero wait state, if 0  MHz < SYSCLK <= 24 MHz
    001 One wait state, if  24 MHz < SYSCLK <= 48 MHz
    010 Two wait states, if 48 MHz < SYSCLK <= 72 MHz */

  FLASH_SetLatency(FLASH_Latency_1);

  /* Start with HSI clock (internal 8mhz), divide by 2 and multiply by 9 to
   * get maximum allowed frequency: 36Mhz
   * Enable PLL, wait till it's stable, then select it as system clock*/

  RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_9);
  RCC_PLLCmd(ENABLE);
  while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) {}
  RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

  /* Set HCLK, PCLK1, and PCLK2 to SCLK (these are default */
  RCC_HCLKConfig(RCC_SYSCLK_Div1);
  RCC_PCLK1Config(RCC_HCLK_Div1);
  RCC_PCLK2Config(RCC_HCLK_Div1);

  /* Set ADC clk to 9MHz (14MHz max, 18MHz default)*/
  RCC_ADCCLKConfig(RCC_PCLK2_Div4);

  /*To save power, use below functions to stop the clock to ceratin
   * peripherals
   * RCC_AHBPeriphClockCmd
   */

  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA, ENABLE);
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_ALL, ENABLE);
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_ALL, ENABLE);
}
Categories: ARM Tags:

320×240 Color Display – SSD2119

January 27th, 2010 55 comments

I finally got the display I bought on eBay to work. It took me a lot of hours as the man I’d bought the display from told me that the display controller was an ILI9320, so I started making code for the display like it was using an ILI9320 controller.

But as it didn’t work, I started debugging using my Raisonance RLink, and just when I looked at the Device variable – a variable which holds the controller number, and is loaded at the initialization process of the display, it showed me that it was an SSD2119 controller.

So I found the SSD2119 datasheet and started recoding using the new Command calls found in the datasheet… Finally it worked and showed some life ๐Ÿ™‚

So right now I have a working SSD2119 code with SetPixel, Text, Circle, Rectangle, Fill and some working Touch Screen commands for the onboard ADS7843 touch screen controller.

Please take a look at this image to see the display in action:

SSD2119 seen from top

SSD2119 from top


SSD2119 Pringles example

The current GUI commands I’ve made is:
void Lcd_Text(u16 x, u16 y, u8 *str, u16 len,u16 Color, u16 bkColor);
void Lcd_Line(u16 x0, u16 y0, u16 x1, u16 y1,u16 color);
void Lcd_Circle(u16 cx,u16 cy,u16 r,u16 color,u8 fill);
void Lcd_Rectangle(u16 x0, u16 y0, u16 x1, u16 y1,u16 color,u8 fill); // Slower than Lcd_ColorBox
void Lcd_Square(u16 x0, u16 y0, u16 width, u16 color,u8 fill);
void Lcd_ClearCharBox(u16 x,u16 y,u16 color);
void Get320240PictureCode(u8* pBuffer,u32 BufferCounter,u32 BaseAddr);

void Lcd_FastRectangle(u16 x0, u16 y0, u16 x1, u16 y1,u16 color,u8 fill); // Faster than Lcd_Rectangle
void Lcd_FastSquare(u16 x0, u16 y0, u16 width, u16 color,u8 fill); // Faster than Lcd_Rectangle
void Lcd_FastClearCharBox(u16 x,u16 y,u16 color);

void DispPic320_240(const unsigned char *str);
void DispPic(u16 x0, u16 y0, const unsigned char *str);

DispPic320_240 and DispPic uses a byte array to show a image – the byte array is converted from a 24-bit .BMP (bitmap) file using a program I’ve made in Visual Basic .NET!

You can download the STM32 code for a Paint Demo application I’ve made here: SSD2119_PaintDemo
OBS.: The project files in there is for Ride7, but the code can be used together with ARM-GCC

Categories: ARM Tags: , , ,

STM32 Nokia LCD

January 27th, 2010 No comments

Finally I found how to use the Nokia LCD I’ve bought from Sparkfun a year ago.
Originally I bought the display for the Arduino, but as the LCD is 3.3V I tried to make a voltage convertion circuit, but it didn’t work ๐Ÿ™
But now, I’ve got the STM32 which is running 3.3V – so I could just connect it directly… And then it worked!

Nokia LCD - Hello World


Nokia LCD - TKJ-Electronics Logo

Categories: ARM Tags: , ,

STM32 DFU Programming

January 25th, 2010 8 comments

The time is currently 21:42 and I’ve been sitting in front of my computer in 2 hours to get the DFU programming to work.

Now it is working, and I’m able to make one of my excisting projects into a DFU loadable project (compiled it’s a .dfu filed)

I’ve also changed the DFU bootloader code to use GPIOA_0 as DFU Enable pin, and GPIOA_1 as USB Disconnect – this makes me able to use the GPIOB and GPIOC for my display without any interferrance!

Here is how you make a Ride7 project DFU loadable:

The Default Startup script (in settings) has been set to No, as we have included a special startup script in the project (startup_stm32f10x_hd.s – found in CMSIS\Core\CM3\startup\gcc)
Also change the Linker Script in project settings to match the processor group you are using (Connectivity, High Density… and so on – fx stm32f10x_hd_flash_offset.ld)
Also be aware of the change in the NVIC_Configuration – here we tell the processor that the Flash has to start at adress 0x3000
When you have compiled the code to a HEX file, run “DFU File Manager” to create a .dfu file.
Target ID: 00 is Internal Flash
Target ID: 01 is SPI Flash
Target ID: 02 is NOR Flash
Now you can use DfuSe to load the .dfu file into the internal flash of your STM32!
Categories: ARM Tags: ,

STM32 USB Connection

January 25th, 2010 8 comments

The USB connection between the STM32 and the computer is finally working.
I’ve tried the different USB programs from the StdPeriph Library

Fx.

  • Virtual COM Port
  • DFU Programming

As I’m using Ride7 for programming, I can upload the project and sources if you want me too.

 

OBS: If you have projects which DOESN’T use the USB, you have to set the USB Disconnect jupmer to Ground (Pos. 1-2), as if not, the STM32 will stop in some kind of USB Interrupt trying to make a data communication with the computer, but it never comes as the STM32 doesn’t start one!

I discovered this รƒ?ร‚ย when I tried DFU’ing my 320×240 LCD code – and when I went back to normal .hex, it didn’t work – that was because I had to set the USB Disconnect to Ground!

Categories: ARM Tags: , , ,