DSP2803x_Sci.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //###########################################################################
  2. //
  3. // FILE: DSP2803x_Sci.c
  4. //
  5. // TITLE: DSP2803x SCI Initialization & Support Functions.
  6. //
  7. //###########################################################################
  8. // $TI Release: F2803x C/C++ Header Files and Peripheral Examples V130 $
  9. // $Release Date: May 8, 2015 $
  10. // $Copyright: Copyright (C) 2009-2015 Texas Instruments Incorporated -
  11. // http://www.ti.com/ ALL RIGHTS RESERVED $
  12. //###########################################################################
  13. #include "DSP2803x_Device.h" // DSP2803x Headerfile Include File
  14. #include "DSP2803x_Examples.h" // DSP2803x Examples Include File
  15. //---------------------------------------------------------------------------
  16. // InitSci:
  17. //---------------------------------------------------------------------------
  18. // This function initializes the SCI(s) to a known state.
  19. //
  20. void InitSci(void)
  21. {
  22. // Initialize SCI-A:
  23. //tbd...
  24. }
  25. //---------------------------------------------------------------------------
  26. // Example: InitSciGpio:
  27. //---------------------------------------------------------------------------
  28. // This function initializes GPIO pins to function as SCI pins
  29. //
  30. // Each GPIO pin can be configured as a GPIO pin or up to 3 different
  31. // peripheral functional pins. By default all pins come up as GPIO
  32. // inputs after reset.
  33. //
  34. // Caution:
  35. // Only one GPIO pin should be enabled for SCITXDA/B operation.
  36. // Only one GPIO pin shoudl be enabled for SCIRXDA/B operation.
  37. // Comment out other unwanted lines.
  38. void InitSciGpio()
  39. {
  40. InitSciaGpio();
  41. }
  42. void InitSciaGpio()
  43. {
  44. EALLOW;
  45. /* Enable internal pull-up for the selected pins */
  46. // Pull-ups can be enabled or disabled disabled by the user.
  47. // This will enable the pullups for the specified pins.
  48. GpioCtrlRegs.GPAPUD.bit.GPIO28 = 0; // Enable pull-up for GPIO28 (SCIRXDA)
  49. // GpioCtrlRegs.GPAPUD.bit.GPIO7 = 0; // Enable pull-up for GPIO7 (SCIRXDA)
  50. GpioCtrlRegs.GPAPUD.bit.GPIO29 = 0; // Enable pull-up for GPIO29 (SCITXDA)
  51. // GpioCtrlRegs.GPAPUD.bit.GPIO12 = 0; // Enable pull-up for GPIO12 (SCITXDA)
  52. /* Set qualification for selected pins to asynch only */
  53. // Inputs are synchronized to SYSCLKOUT by default.
  54. // This will select asynch (no qualification) for the selected pins.
  55. GpioCtrlRegs.GPAQSEL2.bit.GPIO28 = 3; // Asynch input GPIO28 (SCIRXDA)
  56. // GpioCtrlRegs.GPAQSEL1.bit.GPIO7 = 3; // Asynch input GPIO7 (SCIRXDA)
  57. /* Configure SCI-A pins using GPIO regs*/
  58. // This specifies which of the possible GPIO pins will be SCI functional pins.
  59. GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 1; // Configure GPIO28 for SCIRXDA operation
  60. // GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 2; // Configure GPIO7 for SCIRXDA operation
  61. GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 1; // Configure GPIO29 for SCITXDA operation
  62. // GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 2; // Configure GPIO12 for SCITXDA operation
  63. EDIS;
  64. }
  65. //===========================================================================
  66. // End of file.
  67. //===========================================================================