+ Post New Thread
Results 1 to 8 of 8
  1. #1
    Newbie level 2
    Points: 177, Level: 2

    Join Date
    Jan 2012
    Posts
    2
    Helped
    0 / 0
    Points
    177
    Level
    2

    Interfacing a PC graphics card (Radeon HD 2400) with a STM32 microcontroller

    My project involves interfacing an AMD Radeon HD 2400 graphics card with a STM32 Discovery evaluation board. Using AMD's publicly available documentation together with MMIO traces of the proprietary Catalyst driver I have managed to upload and execute code on the GPU's internal hardware video decoder which features a Tensilica Xtensa 32-bit CPU.

    I have written a demo application running on the Xtensa CPU which uses the hardware 3D engine to draw a Z-buffered, gouraud shaded spinning cube on the screen. AMD's Hierarchical-Z feature is enabled to improve performance. The 3D engine is configured using code taken from AMD's open-source Linux driver.

    Photos of the project have been uploaded to Flickr.

    Many PCI Express devices feature a debug interface that is used during ASIC development to allow hardware registers to be modified should the PCIe link fail for some reason or another (e.g. due to incompatibility with the system's northbridge). The HD2400's debug interface is over I2C bus which can be overclocked to run at 1.5MHz when required. Thus it may be easily interfaced to practically any microcontroller for hacking .

    The hardware side involves modifying the HD2400 to enable and bring out the I2C debug interface and supply the necessary PCIe clock signal that is required for the board to operate correctly.

    The firmware I have written comes in two parts; the STM32 side is responsible for setting up the GPU using the BIOS and uploading the Xtensa firmware to the GPU's video RAM, which the Xtensa CPU then executes. The GCC compiler is used together with "newlib" and "libopencm3" libraries to build the firmware for the ARM STM32 architecture.

    The Xtensa side runs on the UVD hardware and again was built using GCC, "newlib" and the open-source FreeRTOS real-time operating system to provide preemptive multitasking.

    I have written code to configure the various internal hardware blocks inside the GPU to enable output to a 8.9 inch 1024x600 netbook LCD directly using "LVDS"/FPDLink signalling from the DVI connector on the card. Normally it is not possible to interface a laptop LCD to a DVI port directly as the data encoding is different however as these GPUs are also used in laptop computers they may be switched into LVDS mode allowing the display to be attached directly.

    Two graphics 'planes' are supported, the background which is the 3D rendered output and the alpha blended overlay which provides a text console using the VGA 16x8 font. These are blended together on-the-fly as the screen is refreshed using the video overlay block and occupy separate addresses in memory.

    The GPU's highly complex 3D hardware features several distinct blocks which operate together to render the 3D scene into video RAM. These are configured using open-source code provided by AMD, including that taken from the r600_demo sample code.

    A vertex buffer located in video RAM holds the vertices of the cube to be rendered in 3D space. These are transformed using a 4x4 model-view-projection matrix implemented as a vertex shader using the DOT4 instruction to carry out the matrix multiplication. The matrix controls control translation, rotation, scaling and projection into 2D viewport coordinates and is calculated once per frame in the demo application.

    Triangles are then rendered with the assistance of the pixel shader which (in this case) simply passes data through unmodified. A Z buffer check is performed to ensure that only visible surfaces are rendered. AMD's hardware supports Hierarchical-Z which reduces the memory bandwidth required performing Z-buffer tests.

    Double buffering is used to eliminate flicker when drawing; one buffer is used for drawing and another is used for display and the two swap places after each frame has been rendered. At most one frame can be rendered per vertical sync event; this is to prevent 'tearing' of the display.

    I will be releasing the source code within a week at most; work remaining involves fixing I2C bus routines in the STM32 code, full SD card support and cleanup of the hardware register database and associated scripts.

    Support for AMD's newer 'CAICOS' (HD6350 IIRC) ASIC is also planned however I am particularly interested in AMD's next generation (HD7xxx) architecture, the moment public documentation is available I will cease work on HD2xxx support.
    Last edited by gpuhackr; 9th January 2012 at 21:38.

    •   Alt9th January 2012, 21:19

      advertising

        
       

  2. #2
    Newbie level 1
    Points: 290, Level: 3

    Join Date
    Apr 2012
    Posts
    1
    Helped
    0 / 0
    Points
    290
    Level
    3

    Re: Interfacing a PC graphics card (Radeon HD 2400) with a STM32 microcontroller

    This really is amazing work.
    How exactly did you do the MMIO sniffing to find out how to load a firmware for the Xtensa CPU?
    And I assume the register layout in the Xtensa CPU is the same as for the PCIe interface?

    Is your code available somwhere? I would be really interested to play with it!

    •   Alt25th April 2012, 11:53

      advertising

        
       

  3. #3
    Newbie level 2
    Points: 213, Level: 2

    Join Date
    Oct 2012
    Posts
    2
    Helped
    0 / 0
    Points
    213
    Level
    2

    Re: Interfacing a PC graphics card (Radeon HD 2400) with a STM32 microcontroller

    This is phenomenal!!
    When will we be able to see your documentation? Could you at least post the connection diagram between the Chi Mei Screen and the Graphiccard?

    •   Alt9th October 2012, 07:04

      advertising

        
       

  4. #4
    Full Member level 1
    Points: 2,314, Level: 11
    Achievements:
    7 years registered
    spiralbrain's Avatar
    Join Date
    Jun 2006
    Posts
    113
    Helped
    23 / 23
    Points
    2,314
    Level
    11

    Re: Interfacing a PC graphics card (Radeon HD 2400) with a STM32 microcontroller

    Outstanding work, can't wait to see what this will help create in the future.

  5. #5
    Newbie level 1
    Points: 37, Level: 1

    Join Date
    Oct 2012
    Posts
    1
    Helped
    0 / 0
    Points
    37
    Level
    1

    Re: Interfacing a PC graphics card (Radeon HD 2400) with a STM32 microcontroller

    Hi,

    Quote Originally Posted by gpuhackr View Post
    I have written code to configure the various internal hardware blocks inside the GPU to enable output to a 8.9 inch 1024x600 netbook LCD directly using "LVDS"/FPDLink signalling from the DVI connector on the card. Normally it is not possible to interface a laptop LCD to a DVI port directly as the data encoding is different however as these GPUs are also used in laptop computers they may be switched into LVDS mode allowing the display to be attached directly.
    Any change to post more information about the LVDS connectivity?

    Kris

  6. #6
    Newbie level 3
    Points: 205, Level: 2

    Join Date
    Mar 2012
    Posts
    3
    Helped
    0 / 0
    Points
    205
    Level
    2

    Re: Interfacing a PC graphics card (Radeon HD 2400) with a STM32 microcontroller

    Great work gpuhackr
    It must have taken months of dedicated work

    does nVIDIA provide public documentation of their older cards such as 9800GT?
    I have one in spare also have the STM32F4-Discovery board

  7. #7
    Newbie level 2
    Points: 177, Level: 2

    Join Date
    Jan 2012
    Posts
    2
    Helped
    0 / 0
    Points
    177
    Level
    2

    Re: Interfacing a PC graphics card (Radeon HD 2400) with a STM32 microcontroller

    BTW I've just uploaded some older photos of the HD2400 hack to Flickr - this was before I got the Xtensa working.
    http://www.flickr.com/photos/7392387...7631771354007/

  8. #8
    Advanced Member level 4
    Points: 5,975, Level: 18

    Join Date
    Jun 2009
    Location
    California
    Posts
    1,149
    Helped
    18 / 18
    Points
    5,975
    Level
    18

    Re: Interfacing a PC graphics card (Radeon HD 2400) with a STM32 microcontroller

    wow amazing, how can you connect it ? GPIO to which pin of VGA card ?
    good work ...

+ Post New Thread
Please login

LinkBacks (?)

  1. 15th November 2013, 14:23
  2. 10th November 2013, 23:06
  3. 30th October 2013, 11:12
  4. 1st October 2013, 18:09
  5. 28th September 2013, 08:12
  6. 11th September 2013, 14:42
  7. 5th September 2013, 16:55
  8. 24th July 2013, 00:04
  9. 14th July 2013, 08:13
  10. 6th July 2013, 15:39
  11. 28th June 2013, 08:02
  12. 25th June 2013, 15:22
  13. 7th June 2013, 20:33
  14. 20th May 2013, 20:49
  15. 16th May 2013, 07:19
  16. 6th May 2013, 13:29
  17. 30th March 2013, 23:24
  18. 19th March 2013, 05:43
  19. 7th March 2013, 16:19
  20. 5th March 2013, 07:33
  21. 28th February 2013, 21:34
  22. 23rd February 2013, 09:31
  23. 20th February 2013, 17:17
  24. 2012
    Refback This thread
    15th February 2013, 21:51
  25. 9th February 2013, 09:24
  26. 1st February 2013, 00:00
  27. 29th January 2013, 06:18
  28. 28th January 2013, 18:11
  29. 28th January 2013, 08:17
  30. 27th January 2013, 18:14
  31. 23rd January 2013, 12:23
  32. 23rd January 2013, 01:36
  33. 18th January 2013, 19:43
  34. 15th January 2013, 18:05
  35. stm32
    Refback This thread
    8th January 2013, 06:36
  36. 22nd December 2012, 12:30
  37. 20th December 2012, 03:52
  38. 17th December 2012, 21:43
  39. 9th December 2012, 11:48
  40. 7th December 2012, 13:02
  41. 1st December 2012, 22:46
  42. 1st December 2012, 22:46
  43. 1st December 2012, 22:36
  44. arm
    Refback This thread
    30th November 2012, 01:46
  45. 29th November 2012, 11:05
  46. 19th November 2012, 21:09
  47. 19th November 2012, 10:35
  48. 17th November 2012, 21:53
  49. 16th November 2012, 18:02
  50. 7th November 2012, 20:37