0

I have raspberry-pi 2 and i made a python program. My python program can detect BLE and send scan results using MQTT. The program will run automatically when restarted [Using cron-table]. Then I did mass cloning using the OS developed on Raspberry-pi2. After cloning, I tried on raspberry-pi 3 but BLE can't be scanned.

I've tried to troubleshoot by:

  1. Turn off crontab and run python program with terminal [BLE scan success]
  2. Run crontab again after doing hciconfig up and hciconfig down. [Not successful]
  3. Added shell script before python program in crontab [Unsuccessful]
  4. Run the command "sudo hcitool lescan" [scan success]

An indication of the problem that occurs is that when the cron-table is turned on, the BLE scan cannot run.

List of Figures:

  1. When running the program in terminal ["sudo python3 scanning.py"] enter image description here
  2. When running the command "sudo hcitool lescan" in the terminal enter image description here
  3. Command on crontable enter image description here

Hardware:

  1. Raspberry Pi 2 Model B V1.2
  2. Raspberry Pi 3 Model B+

Operating System:

  1. OS 10 [2021-03-04-raspios-buster-armhf-full.img]

Can anyone help? What caused this to happen?

5
  • How are you doing the scanning in your Python code? hciconfig has been deprecated . What is the status reported when you do sudo service bluetooth status? Are there any errors reported in journalctl -k? There are some benefits to using systemd for startup scripts like making sure the required parts of the system are up before running your script. In crontab, you can put a long sleep before your script is started?
    – ukBaz
    Feb 17, 2022 at 14:33
  • Also, it is preferred if you copy and paste text (and format in a code block) rather than put screenshots
    – ukBaz
    Feb 17, 2022 at 14:34
  • @ukBaz I'm sorry, the program code is secret. But, I describe correctly and I'm sure it's not coded wrong because this system has been running for almost 2 years on raspberry-pi 2.
    – renaldyks
    Feb 17, 2022 at 14:41
  • @ukBaz oh thanks, i have a error like this "Sap driver initialization failed." and "Failed to set privacy: Rejected (0x0b)"
    – renaldyks
    Feb 17, 2022 at 14:42
  • Are you running any of the cloned systems close to the original? If so turn all of the cloned ones off, and just use the original.
    – NomadMaker
    Jul 17, 2022 at 20:09

1 Answer 1

0

it's a stupid solution, just make delay after rebooting system if you used crontable

@reboot sleep 15 && /home/pi/Desktop/..... .py 

I'm sorry because my brain is stopped working. :D Have a nice day

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.