MikroElektronika / mikrosdk_v2

mikroSDK 2.0 is an embedded software development framework designed to simplify and accelerate application development on Mikroe hardware platform, specifically for Click Boards™ and other extension board drivers, on a wide range of microcontroller vendors and architectures.
https://www.mikroe.com/mikrosdk
Other
63 stars 38 forks source link

Connecting mikroE Click Boards/mikroBus Cape with a BeagleBone Black help wanted #1

Closed ckoehler0 closed 2 years ago

ckoehler0 commented 3 years ago

TL;DR: How to access a mikroE click module via SPI using a BeagleBone Black and a mikroBus Cape?

Hello, I'm currently trying to connect my BeagleBone Black Rev C with the mikroBus Cape (PID: MIKROE-1857). Furthermore, I want to get access to a MRAM click module (https://www.mikroe.com/mram-click) by connecting it with the mikroBus Cape. My BBB is running the latest Debian image (AM3358 Debian 10.3 2020-04-06 4GB SD IoT) and with uname_r=4.14.108-ti-r141.

Firstly, I tried to work with U-Boot overlays:

1. I followed the instructions on https://elinux.org/Tigal:BeagleBone_mikrobuscape but used the updated url "https://github.com/mikroe/BBB-mikroBUS-Cape". But, after setting the "uboot_overlay_addr0=/lib/firmware/BB-MIKROBUS-01-00A1.dtbo" in the uEnv.txt the board would not boot.

2. I followed the instructions on "https://github.com/beagleboard/bb.org-overlays/" and I also upgraded my bootloader (https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays). And after setting all four BB-MIKROBUS-CAPE-X.dtbo files in "uboot_overlay_addrY=..." the board booted. (It also boots when only one is enabled)

Next I wanted to get access to the click module on the mikroBus Cape. A. I downloaded the mikroSDK 2.0 (https://www.mikroe.com/mikrosdk) on the BBB, but I couldn't find nor create the correct board.h file to get it running. After stumbling upon "NectoStudio" I could only find support for generic ARM boards which are from the STM32 family, which the BBB Rev C is not. (Getting access to the mikroSDK 2.0 would allow the usage of scripts via https://libstock.mikroe.com/ which would open up many other possibilities)

As I couldn't get the mikroSDK 2.0 working, I tried to get direct access via SPI to the click module. For that I put the click module on the mikroBus Cape slot 3 (CS - Pin 17, D1/MISO - Pin 21, D0/MOSI - Pin 18 and CLK - Pin 22).

B. After some research I found the iobb library and followed its instructions (https://www.element14.com/community/community/designcenter/single-board-computers/next-genbeaglebone/blog/2019/08/15/beaglebone-black-bbb-io-gpio-spi-and-i2c-library-for-c-2019-edition). After installation, I tried to run the example SPI code without any changes (so not using option 2.) and it runs error-free. But when I enable the BB-MIKROBUS-CAPE-3.dtbo I always get "ERROR: open() for /sys/devices/platform/ocp/ocp:P9_17_pinmux/state failed, No such file or directory" So, after some investigation I realised that BB-MIKROBUS-CAPE-3.dtbo sets "P9_X_pinmux { status = "disabled"; };" for X = {18,19,21,22} and doesn't enable spi in its pinctrl-section, which could be the cause for the problem.

So I tried two things:

To my understanding both of this ways should enable SPI, but when I try to read previously written data from the click module, I can't receive any data at all or select a cell to write to.

So, is there a way to get any of my attempts working so that I can get access to the click module via SPI? Or have I overlooked an other solution?

Btw:

ckoehler0 commented 2 years ago

The issues were due to an internal error of the beagle bone.