查看: 757|回复: 5

RA6M5开发板 IIC-OLED测试学习

[复制链接]

1

主题

3

帖子

373

积分

中级会员

Rank: 3Rank: 3

积分
373
发表于 2023-5-13 16:50:05 | 显示全部楼层 |阅读模式
野火RA6M5开发板 IIC-OLED测试学习
野火RA6M5开发板,这里我使用的时SCI模块里面的SCL5 SDA5 ,配置引脚为P805,P513,配置的过程主要是在官方的e2studio去配置的,简单的点几下就可以了
具体参考下面的博客
由于我的jlink版本不支持Cortex-M33内核的芯片下载,现在只能通过Uart串口烧写,开发文档上面也有具体的操作
瑞萨开发板通过Uart串口烧写程序参考博文 https://bbs.elecfans.com/jishu_2322246_1_1.html
IIC配置 参考文章 瑞萨e2studio-IIC-12864OLED移植 https://blog.csdn.net/qq_24312945/article/details/121373564
野火RA6M5开发板,这里我使用的时SCI模块里面的SCL5 SDA5 ,配置引脚为P805,P513

  1. //--------------------------------------------------------------------------------------------------
  2. // 函数头文件    |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9
  3. //--------------------------------------------------------------------------------------------------
  4. #include "hal_data.h"
  5. #include "oled.h"
  6. #include "bmp.h"
  7. #include "bsp_debug_uart.h"
  8. #include "bsp_led.h"
  9. FSP_CPP_HEADER
  10. void R_BSP_WarmStart(bsp_warm_start_event_t event);
  11. FSP_CPP_FOOTER

  12. /* Callback function */
  13. i2c_master_event_t i2c_event = I2C_MASTER_EVENT_ABORTED;
  14. void sci_i2c_master_callback(i2c_master_callback_args_t *p_args)
  15. {
  16.     i2c_event = I2C_MASTER_EVENT_ABORTED;
  17.     if (NULL != p_args)
  18.     {
  19.         /* capture callback event for validating the i2c transfer event*/
  20.         i2c_event = p_args->event;
  21.     }

  22. }

  23. fsp_err_t err = FSP_SUCCESS;
  24. uint32_t  timeout_ms = 1000;


  25. void Hardware_init(void)
  26. {


  27.             Debug_UART4_Init(); // SCI4 UART 调试串口初始化
  28.             printf("Debug-UART4-Init OK \r\n");
  29.             LED_Init();
  30.             printf("LED_Init    OK \r\n");
  31.             printf("IIC-Config  OK \r\n");
  32.             /* Initialize the I2C module */
  33.             err = R_SCI_I2C_Open(&g_i2c5_ctrl, &g_i2c5_cfg);
  34.             /* Handle any errors. This function should be defined by the user. */
  35.             assert(FSP_SUCCESS == err);
  36.             printf("IIC-Config OK \r\n");
  37.             OLED_Init();            //初始化OLED
  38.             OLED_Clear();
  39.             printf("oled-Init OK \r\n");
  40. }
  41. /*******************************************************************************************************************//**
  42. * main() is generated by the RA Configuration editor and is used to generate threads if an RTOS is used.  This function
  43. * is called by main() when no RTOS is used.
  44. **********************************************************************************************************************/
  45. void hal_entry(void)
  46. {
  47.     /* TODO: add your own code here */

  48.           Hardware_init();
  49.           printf("RA6M5-Board-Init OK \r\n");


  50.           while(1)
  51.           {
  52.                 LED1_ON; // LED1亮
  53.                 LED2_ON; // LED2亮
  54.                 LED3_ON; // LED3亮
  55.                 R_BSP_SoftwareDelay(500, BSP_DELAY_UNITS_MILLISECONDS); //延时1秒
  56.                 LED1_OFF; // LED1灭
  57.                 LED2_OFF; // LED2灭
  58.                 LED3_OFF; // LED3灭
  59.                 R_BSP_SoftwareDelay(500, BSP_DELAY_UNITS_MILLISECONDS); //延时1秒
  60.   

  61.                  printf("oled-Init OK \r\n");
  62.                  OLED_ShowCHinese(0,0,0);//瑞
  63.                  OLED_ShowCHinese(16,0,1);//萨
  64.                  OLED_ShowCHinese(32,0,5);//电
  65.                  OLED_ShowCHinese(48,0,6);//子
  66.                  OLED_ShowString(60,0,"Renesas",16);
  67.                  OLED_ShowNum(0,2,2023,4,16);//显示ASCII字符的码值
  68.                  OLED_ShowCHinese(32,2,2);//中文字->年
  69.                  OLED_ShowNum(48,2,5,2,16);//显示ASCII字符的码值
  70.                  OLED_ShowCHinese(64,2,3);//中文字->月
  71.                  OLED_ShowNum(80,2,12,2,16);//显示ASCII字符的码值
  72.                  OLED_ShowCHinese(96,2,4);//中文字->日
  73.                  OLED_ShowString(0,4,"By2023-CoderEnd",12);
  74.                  OLED_ShowString(0,5,"Embedfire-Board",12);
  75.                  OLED_ShowString(0,6,"R7FA6M5BH3CFC",16);

  76.                   R_BSP_SoftwareDelay(4, BSP_DELAY_UNITS_SECONDS); //延时1秒
  77.                   OLED_Clear();
  78.                   OLED_DrawBMP(0,0,64,8,BMP1);
  79.                   R_BSP_SoftwareDelay(4, BSP_DELAY_UNITS_SECONDS); //延时1秒
  80.                   OLED_Clear();

  81.           }



  82. #if BSP_TZ_SECURE_BUILD
  83.     /* Enter non-secure code */
  84.     R_BSP_NonSecureEnter();
  85. #endif
  86. }

  87. /*******************************************************************************************************************//**
  88. * This function is called at various points during the startup process.  This implementation uses the event that is
  89. * called right before main() to set up the pins.
  90. *
  91. * @param[in]  event    Where at in the start up process the code is currently at
  92. **********************************************************************************************************************/
  93. void R_BSP_WarmStart(bsp_warm_start_event_t event)
  94. {
  95.     if (BSP_WARM_START_RESET == event)
  96.     {
  97. #if BSP_FEATURE_FLASH_LP_VERSION != 0

  98.         /* Enable reading from data flash. */
  99.         R_FACI_LP->DFLCTL = 1U;

  100.         /* Would normally have to wait tDSTOP(6us) for data flash recovery. Placing the enable here, before clock and
  101.          * C runtime initialization, should negate the need for a delay since the initialization will typically take more than 6us. */
  102. #endif
  103.     }

  104.     if (BSP_WARM_START_POST_C == event)
  105.     {
  106.         /* C runtime environment and system clocks are setup. */

  107.         /* Configure pins. */
  108.         R_IOPORT_Open (&g_ioport_ctrl, g_ioport.p_cfg);
  109.     }
  110. }

  111. #if BSP_TZ_SECURE_BUILD

  112. BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable ();

  113. /* Trustzone Secure Projects require at least one nonsecure callable function in order to build (Remove this if it is not required to build). */
  114. BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable ()
  115. {

  116. }
  117. #endif
复制代码
开发板测试效果图

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

1

主题

3

帖子

1248

积分

金牌会员

Rank: 6Rank: 6

积分
1248
发表于 2023-5-14 08:54:24 | 显示全部楼层

这里发有什么好处,感觉这里一点都不活跃
回复

使用道具 举报

1

主题

3

帖子

373

积分

中级会员

Rank: 3Rank: 3

积分
373
 楼主| 发表于 2023-5-14 15:22:30 | 显示全部楼层
Thread 发表于 2023-5-14 08:54
这里发有什么好处,感觉这里一点都不活跃

的确,感觉太死了,算了算了,不发了
回复

使用道具 举报

0

主题

21

帖子

4870

积分

论坛元老

Rank: 8Rank: 8

积分
4870
发表于 2023-5-16 10:09:24 | 显示全部楼层

学习一下
回复

使用道具 举报

9

主题

95

帖子

9369

积分

论坛元老

Rank: 8Rank: 8

积分
9369
发表于 2023-5-17 08:07:28 | 显示全部楼层
End 发表于 2023-5-14 15:22
的确,感觉太死了,算了算了,不发了

可以攒积分
回复

使用道具 举报

0

主题

21

帖子

4870

积分

论坛元老

Rank: 8Rank: 8

积分
4870
发表于 2023-5-22 09:31:37 | 显示全部楼层

学习一下
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

用户排行榜

RA助手

主题: 116帖子:133精华:0

RA_Lance

主题: 92帖子:132精华:9

lugl

主题: 38帖子:126精华:0

xujiwei263

主题: 16帖子:73精华:0

books咦

主题: 11帖子:11精华:2

Juggernaut

主题: 9帖子:95精华:0
快速回复 返回顶部 返回列表