Thursday, August 10, 2023

Using IO Stream and EXP pins on Silabs EFR32MG24+BRD4001A as second UART

The following steps show you how to create GSDK4.3.1/EmberZnet 7.3.1.0 Z3Light example with  BRD4186C+BRD4001A and use sl_iostream_write/sl_iostream_read to output/read data to/from USART1 to EXP header pin11(RX PA06)/p13(TX PA07).

1. Add exp instance from software component

圖片圖片2. Add the following code to main.c

  1. #include "sl_iostream.h"
  2. sl_iostream_t * exp_iostream = NULL;
  3. uint8_t rbuffer[128];
  4. size_t bread;
  5.  
  6. void app_init(void)
  7. {
  8. exp_iostream = sl_iostream_get_handle("exp");
  9. }
  10.  
  11. void app_process_action(void)
  12. {
  13. sl_iostream_read(exp_iostream,rbuffer,128,&bread);
  14. if(bread>0){
  15. sl_iostream_write(exp_iostream,rbuffer,bread);
  16. }
  17. }

 3. Build and run the example.

No comments:

Post a Comment