Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 18336

Re: How to read binary data via Serial1?

$
0
0

Hi KurtE,

Yes your assumptions are close.

I have listed more info below.

Any insights appreciated,

Thank you

 

 

Excerpts of C code on Edison:

static const char *PORT_NAME = "/dev/ttyMFD2";

serial_port = open(PORT_NAME, O_RDWR | O_NONBLOCK );

if (serial_port != -1)

  {

   printf("Serial Port open\n");

   tcgetattr(serial_port,&options_original);

   tcgetattr(serial_port, &options);

   cfsetispeed(&options, B115200);

   cfsetospeed(&options, B115200);

   options.c_cflag |= ( CLOCAL | CREAD );

   options.c_lflag |= ICANON;

   tcsetattr(serial_port, TCSANOW, &options);

  }

...

...

main() {

.....

int chars_read;

while (1) {

chars_read = read(serial_port, read_buffer, max_chars_to_read);

 

if (chars_read > 0){
for(int i=0;i<chars_read;i++) {
  printf("%c",read_buffer[i]);
}
printf("\n");
}

} // while


} // main

When I connect the Edison J16 to PC via micro B to USB A cable, and run puTTy, I can see what I type on puTTy printed out, indicating

the Edison is reading and printing chars.


Then on microcontroler MK20DX256, it is similar C code. This C code is doing : println("Hello World..\n"); which I can see on puTTy.

-------


The command lsusb did not show any USB attached to J16: Maybe this is main issue, no USB or serial link detected on J16

 

lsusb

unable to initialize libusb: -99

 

---------dmesg output:

 

dmesg | tail -20

[   36.983467] link down if wlan0 may call cfg80211_disconnected. event : 6, reason=15 from 00:14

:bf:39:71:1b

[   36.988928] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_LINK

[   36.993093] cfg80211: Calling CRDA to update world regulatory domain

[   41.459945] CFG80211-ERROR) wl_cfg80211_connect : Connectting with00:14:bf:39:71:1b channel (6

) ssid "hkclients", len (9)

[   41.459945]

[   41.538052] wl_bss_connect_done succeeded with 00:14:bf:39:71:1b

[   41.638302] wl_bss_connect_done succeeded with 00:14:bf:39:71:1b

[   45.612291] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_DEAUTH_IND

[   45.612332] link down if wlan0 may call cfg80211_disconnected. event : 6, reason=15 from 00:14

:bf:39:71:1b

[   45.616244] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_LINK

[   45.619456] cfg80211: Calling CRDA to update world regulatory domain

[   50.108241] CFG80211-ERROR) wl_cfg80211_connect : Connectting with00:14:bf:39:71:1b channel (6

) ssid "hkclients", len (9)

[   50.108241]

[   50.197275] wl_bss_connect_done succeeded with 00:14:bf:39:71:1b

[   50.222885] wl_bss_connect_done succeeded with 00:14:bf:39:71:1b

[   51.611228] ip (280) used greatest stack depth: 5216 bytes left

[   89.377248] EXT4-fs (mmcblk0p10): mounted filesystem with ordered data mode. Opts: discard,bar

rier=1,data=ordered,noauto_da_alloc

 




Viewing all articles
Browse latest Browse all 18336

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>