harishreddy
Posts: 18
Joined: Wed Jul 11, 2018 9:37 am

we are trying to use gpio pin as chip select

Mon Sep 03, 2018 11:44 am

we are trying to use gpio pin as chip select .but we struck across a build error as in the screenshot.please help us in the same.
Attachments
Capture.PNG
GPIO controllig
Capture.PNG (80.39 KiB) Viewed 1008 times

User avatar
buja
Posts: 465
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: we are trying to use gpio pin as chip select

Mon Sep 03, 2018 12:59 pm

You need to include the bcm2825 library in your build command: -lbcm2835
(I don't have Geany available right now, so I cannot be more specific at the moment).

harishreddy
Posts: 18
Joined: Wed Jul 11, 2018 9:37 am

Re: we are trying to use gpio pin as chip select

Tue Sep 04, 2018 4:50 am

Hi,

Please help us on briefly.....

User avatar
buja
Posts: 465
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: we are trying to use gpio pin as chip select

Tue Sep 04, 2018 6:18 am

It could be as easy as this:

1. Menu Build / Set Build Commands
The line Build will show something like this: gcc -Wall -o "%e" "%f" -lm
2. Add -lbcm2835 to this line: gcc -Wall -o "%e" "%f" -lm -lbcm2835
3. Build the program again

Of course you should have installed the bcm2835 library correctly in the first place. The instructions on the website http://www.airspayce.com/mikem/bcm2835/ are easy to follow.

harishreddy
Posts: 18
Joined: Wed Jul 11, 2018 9:37 am

Re: we are trying to use gpio pin as chip select

Tue Sep 04, 2018 7:23 am

Hi,

Thanks for Your reply,we have tried your earlier post but now we are getting another build error as in the screenshot.please help us in the same.
Attachments
Capture.PNG
Capture.PNG (53.49 KiB) Viewed 897 times

User avatar
Paeryn
Posts: 2143
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: we are trying to use gpio pin as chip select

Tue Sep 04, 2018 11:44 am

harishreddy wrote:
Tue Sep 04, 2018 7:23 am
Hi,

Thanks for Your reply,we have tried your earlier post but now we are getting another build error as in the screenshot.please help us in the same.
You haven't put spaces between the filename and the two libraries so it is thinking the filename is all three strings concatenated. It should be

Code: Select all

gcc -Wall -o "%e" "%f" -lm -lbcm2835
She who travels light — forgot something.

harishreddy
Posts: 18
Joined: Wed Jul 11, 2018 9:37 am

Thu Sep 06, 2018 10:08 am

Hi,

Thanks for Your reply,we have tried your earlier post but now we are getting another error ,when adding GPIO Example program to our main application
Attachments
Capture.PNG
Capture.PNG (28.94 KiB) Viewed 832 times

User avatar
buja
Posts: 465
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: we are trying to use gpio pin as chip select

Thu Sep 06, 2018 10:40 am

You have to run you program with superuser privileges.
If your program is called Blinky, try to run it like this:

Code: Select all

sudo ./Blinky

harishreddy
Posts: 18
Joined: Wed Jul 11, 2018 9:37 am

Re: we are trying to use gpio pin as chip select

Thu Sep 06, 2018 12:17 pm

Thank you very much for your quick response and valuable suggestions,now it is working

harishreddy
Posts: 18
Joined: Wed Jul 11, 2018 9:37 am

raspberry pi 3 model b+ with bcm 2835

Fri Sep 07, 2018 8:01 am

we are working on raspberry pi 3 model b+module with bcm 2835 library but getting error No such file or directory
Attachments
Capture.PNG
Capture.PNG (18.32 KiB) Viewed 774 times

User avatar
topguy
Posts: 4854
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: we are trying to use gpio pin as chip select

Fri Sep 07, 2018 9:01 am

It worked for your previous program, it has exactly the same line. So what is different ?
New Pi ? Did you forget to install something on the new Pi ? The bcm2835 library for example.

harishreddy
Posts: 18
Joined: Wed Jul 11, 2018 9:37 am

raspberry pi 3 model b+ with bcm 2835

Fri Sep 07, 2018 10:14 am

Hi,

Thanks for Your reply,we have installed bcm2835 libray but now we are getting segmentation fault error while running exe file

User avatar
Paeryn
Posts: 2143
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: raspberry pi 3 model b+ with bcm 2835

Fri Sep 07, 2018 10:43 am

harishreddy wrote:
Fri Sep 07, 2018 10:14 am
Hi,

Thanks for Your reply,we have installed bcm2835 libray but now we are getting segmentation fault error while running exe file
Since at this moment in time the only thing we know about this program is that one #include <bcm2835.h> line, the seg fault could be from anywhere in your program and the only person who can see the source code is you. Without being able to see any of the code how do you expect us to help you?
She who travels light — forgot something.

User avatar
topguy
Posts: 4854
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: raspberry pi 3 model b+ with bcm 2835

Fri Sep 07, 2018 11:01 am

harishreddy wrote:
Fri Sep 07, 2018 10:14 am
Thanks for Your reply,we have installed bcm2835 libray but now we are getting segmentation fault error while running exe file
Congratutaion, you have your first bug in a program.

harishreddy
Posts: 18
Joined: Wed Jul 11, 2018 9:37 am

Re: we are trying to use gpio pin as chip select

Mon Sep 10, 2018 12:13 pm

Hi,

Thanks for Your reply, we are operating GPIO pins using bcm2835 library for that we passing two arguments in our program but we are getting segmentation fault error while passing the arguments.
Eg; write_DO(1,1)
Attachments
Capture1.PNG
Capture1.PNG (24.72 KiB) Viewed 664 times

User avatar
Paeryn
Posts: 2143
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: we are trying to use gpio pin as chip select

Mon Sep 10, 2018 12:58 pm

harishreddy wrote:
Mon Sep 10, 2018 12:13 pm
Hi,

Thanks for Your reply, we are operating GPIO pins using bcm2835 library for that we passing two arguments in our program but we are getting segmentation fault error while passing the arguments.
Eg; write_DO(1,1)
Had you called bcm2835_init() earlier in your program, if so did it return 0? If you didn't call it or it returned 0 then the library hasn't been initialised and the other functions are likely to cause seg faults as they will end up writing to invalid addresses.
She who travels light — forgot something.

harishreddy
Posts: 18
Joined: Wed Jul 11, 2018 9:37 am

running as root error

Tue Sep 11, 2018 1:09 pm

Hi,
we are trying to run spi.c file which we found in the bcm2835 library examples.While running we are getting the following error.
As the error indicates the application is to be run as root,what that exactly indicates?
How to move our application in root and how to open, create password for root.Please suggest me on the same.
Attachments
spi_error.PNG
spi_error.PNG (76.69 KiB) Viewed 610 times

DirkS
Posts: 9038
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: running as root error

Tue Sep 11, 2018 1:41 pm

harishreddy wrote:
Tue Sep 11, 2018 1:09 pm
While running we are getting the following error.
It would be good if you could post code and error messages as text instead of screen dumps.
It makes it easier for other users to copy essential bits and use them wherever needed (e.g. web search)

Heater
Posts: 9832
Joined: Tue Jul 17, 2012 3:02 pm

Re: we are trying to use gpio pin as chip select

Tue Sep 11, 2018 1:48 pm

To run a program, say myProg, as the root user user use the "sudo" command:

$ sudo ./myProg

harishreddy
Posts: 18
Joined: Wed Jul 11, 2018 9:37 am

SD card is not booting

Thu Oct 04, 2018 1:32 pm

Hiiii,

Our SD card worked well for a while,but suddenly it is not been booting up with raspberry pi. We are trying to login the Card but not happening.
For the command sudo startx we are getting the reply as shown in the image.Please help us in solving the issue.
Attachments
boot screenshot.jpg
boot screenshot.jpg (44.08 KiB) Viewed 283 times

DirkS
Posts: 9038
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: we are trying to use gpio pin as chip select

Thu Oct 04, 2018 2:25 pm

'sudo startx' is an almost guaranteed way to break stuff...
Use 'startx' without sudo.

You may have to change the settings of the .XAuthority file to get that to work:

Code: Select all

sudi chown pi:pi ~/.Xauthority

harishreddy
Posts: 18
Joined: Wed Jul 11, 2018 9:37 am

Is there any chance of corrupting SD card

Fri Oct 05, 2018 4:49 am

1.Thank you for the reply but that doesn't worked out here.If any power ON&OFF condition is there any chance of corrupting of SD card.In any case,if corrupted please help us how to recover the Files over the sd card.


2.All our applications i.e., programs(.c files ) will reside on SD card or Processor inbuilt memory????????Please answer the query.we tried to open the SD card with a card reader in laptop all the boot and recovery section appeared but no .c files.Why?????

DirkS
Posts: 9038
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Is there any chance of corrupting SD card

Fri Oct 05, 2018 6:24 am

harishreddy wrote:
Fri Oct 05, 2018 4:49 am
2.All our applications i.e., programs(.c files ) will reside on SD card or Processor inbuilt memory????????Please answer the query.we tried to open the SD card with a card reader in laptop all the boot and recovery section appeared but no .c files.Why?????
No idea... Are you looking in the correct location?
If it's a Windows notebook then you will need additional software to read the SD card.

You can try to use your Pi to read the card: take your spare SD card, put Raspbian on it, stick the card in a USB card reader and put the reader in the Pi.
Mount the partition with your files and recover them to another location.

And if that does not work then you need to use the backup of your files...

Anyway, this has nothing to do with your original problem and you should have started a new topic

harishreddy
Posts: 18
Joined: Wed Jul 11, 2018 9:37 am

unable to open the display of raspberry pi

Tue Oct 09, 2018 7:01 am

Hiii,

Our SD card worked well for about 3 months.
1.We are using 16GB SD card in raspberry pi and accessing the root section through remote access but no display is being appearing.Before a while it has shown that free space 0 bytes,when we tried to copy paste a file.

Generally programs size will not be much.But our raspberry pi module shown free space left:0 bytes.Why???

Please help us to solve the issue.

2.by using WINSCP application we are able to access the PI directory from windows but not ROOT directory.why so??

Heater
Posts: 9832
Joined: Tue Jul 17, 2012 3:02 pm

Re: we are trying to use gpio pin as chip select

Tue Oct 09, 2018 7:53 am

harishreddy,
...If any power ON&OFF condition is there any chance of corrupting of SD card.
Yes. If power is cut ant random at least 3 significant things can happen.

a) Any files being written, by you application or whatever, may be corrupted. Or at least the updates will be lost.

b) The file system can become corrupted resulting in a Pi that will not boot up. This can be fixed by re-imaging the card. Any files you have on there will be lost in that process.

c) The SD card itself becomes unusable. Manifested as looking like a read only card. The card will need replacing.

All these things are quite rare occurrences but for the long haul I would advice ensuring you never get random power failures and always shutdown the OS properly before cutting power.

For ultimate reliability make your root file system read-only. If you search this forum for real only root you will find instructions as to how to do that.

As ever, be sure you have backups of any files you value.
In any case,if corrupted please help us how to recover the Files over the sd card.
If the file system on your SD is still readable there are a few ways to go.

a) Find a Linux PC with a card reader and read the SD using that.

b) On Windows, install "Linux File Systems for Windows" by Paragon Software: https://www.paragon-software.com/home/linuxfs-windows/. With that you will be able to read the root file system from Windows. There is a free trial period of LFSW and it will continue to work after the trial period but at reduced speed. Good enough for occasional use. It's a cheap license to buy if you need it more.
...we tried to open the SD card with a card reader in laptop all the boot and recovery section appeared but no .c files.Why?????
Because the root file system of Raspbian is a Linux ext4 format. Windows is to primitive to understand such things. Hence the need for LFSW. See above.
All our applications i.e., programs(.c files ) will reside on SD card or Processor inbuilt memory
You applications will reside on SD card. It also possible to boot some Pi from USB stick or USB connected SSD/hard drive.

There is no memory built into the processor.
by using WINSCP application we are able to access the PI directory from windows but not ROOT directory.why so??
So your Pi does boot and you can login to it using SSH. If you are logged in a "pi" or other non-root user you will need to get root prividges to many things. Use the "sudo" command for this: For example:

$ sudo ls -l /root

If you cannot find your C files with any of the methods mentioned here I'm afraid they are gone for ever.

Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 7 guests