2009-05-10 08:14:02     Yet another SPORT question

Document created by Aaronwu Employee on Aug 15, 2013
Version 1Show Document
  • View in full screen mode

2009-05-10 08:14:02     Yet another SPORT question

Jeppe Ledet-Pedersen (DENMARK)

Message: 73920   

 

Hi

 

I'm trying to figure out how to use the SPORT on my BF537-STAMP v2.1. I'm quiet unexperienced with embedded Linux, but I've managed to compile and install uClinux-dist-2008R1.5-RC3 - you can see my .config file here:   kom.aau.dk/~jledet/config

 

I've put this test program and Makefile together

 

aisd.c:   pastebin.com/f45427e53

 

Makefile:   pastebin.com/f6789947c

 

The files compile without any warnings, but when I run the program all I get is:

 

root:~> ./aisd

Using SPORT /dev/sport1

Opening SPORT...done

Configuring SPORT...failed

 

To start with, I would like just to write some data to the port, and verify it with an oscilloscope. Can you give me a push in the right direction? If you need more info about my configuration, please let me know.

 

Best regards,

 

Jeppe

QuoteReplyEditDelete

 

 

2009-05-10 08:38:31     Re: Yet another SPORT question

Jeppe Ledet-Pedersen (DENMARK)

Message: 73921   

 

If I insert a perror("ioctl") after the failed configuration, I get "ioctl: Invalid argument" as output - still can't figure out what I do wrong, though...

QuoteReplyEditDelete

 

 

2009-05-10 09:23:01     Re: Yet another SPORT question

Jeppe Ledet-Pedersen (DENMARK)

Message: 73922   

 

Line 76:

 

"if ((sportfd = open(sportfile, O_RDWR, 0) < 0)) {"

 

should of course be

 

 

 

"if ((sportfd = open(sportfile, O_RDWR, 0)) < 0) {"

 

Now it just hangs after configuring the SPORT. Could it be a clock problem?

QuoteReplyEditDelete

 

 

2009-05-11 10:44:22     Re: Yet another SPORT question

Kyle Schlansker (UNITED STATES)

Message: 73953    I'm not sure what happens when you reset permissions on an existing file/device at open time, but I would try replacing your call to open with the shortened calling convention:

"if ((sportfd = open(sportfile, O_RDWR)) < 0) {"

QuoteReplyEditDelete

 

 

2009-05-11 14:14:11     Re: Yet another SPORT question

Mike Frysinger (UNITED STATES)

Message: 73958   

 

please do not use external sites for posting files.  they will die over time and people cant refer to them.  post the files as attachments using the gforge system.

QuoteReplyEditDelete

 

 

2009-05-11 14:14:47     Re: Yet another SPORT question

Mike Frysinger (UNITED STATES)

Message: 73959   

 

the mode argument should be ignored completely if O_CREAT is not used

QuoteReplyEditDelete

 

 

2009-05-12 04:42:46     Re: Yet another SPORT question

Jeppe Ledet-Pedersen (DENMARK)

Message: 73987   

 

Hi,

 

Thank you for answering! I've removed the mode argument, but it does not seem to make a difference. I also tried to set the SPORT to use the internal clock, with a frequency of 10kHz.

 

I have attached my

 

aisd.c

Makefile

QuoteReplyEditDelete

 

 

2009-05-12 04:53:20     Re: Yet another SPORT question

Jeppe Ledet-Pedersen (DENMARK)

Message: 73988   

 

Sorry for the incomplete post. I have tried to monitor the output with a scope. With a wordlength of 32, 8 clock bits with the right frequency is clocked out on TSCLK1 - but no data. If I adjust the word length to 8, the bf just continuously clocks on the TSCLK1 until the watchdog restarts the chip.

 

I don't know if the attached files work - otherwise I have uploaded the files to   kom.aau.dk/~jledet/aisd.c and   kom.aau.dk/~jledet/Makefile

 

Thank you for your help

 

aisd.c

Makefile

QuoteReplyEditDelete

 

 

2009-05-18 03:37:35     Re: Yet another SPORT question

Jeppe Ledet-Pedersen (DENMARK)

Message: 74178   

 

I still haven't been able to transmit data properly using the SPORT. I someone has a functional piece of code using the SPORT, I would really appreciate if you would post it here. Once again, thank you for your help.

QuoteReplyEditDelete

 

 

2009-05-19 14:48:49     Re: Yet another SPORT question

Robin Getz (UNITED STATES)

Message: 74281   

 

There are lots of SPORT examples in the kernel drivers, and userspace examples.

 

If you are trying to get one working, and it does not - submit a bug report.

 

-Robin

Attachments

Outcomes