Advice about swapping MikroBUS 1 and 2 needed pls.

General discussion on mikroBasic PRO for PIC.
Post Reply
Author
Message
chris11jed
Posts: 156
Joined: 15 Jun 2011 06:37

Advice about swapping MikroBUS 1 and 2 needed pls.

#1 Post by chris11jed » 24 Jul 2020 11:05

Hello all,

Could I get some advice on swapping a click-board to a different MikroBUS please?

In a project I'm thinking about, I'm planning on using two click-boards,ETH Click, and WiFi 9 Click.
Also, I am thinking of running both these boards from one MCU (PIC18F87K22), utilizing MikroBUS 1 and 2.
All on development board EasyPIC PRO v7

I have successfully downloaded from LibStock, then 'edited search paths' and 'rebuild all sources' on both boards example-code.
Both examples compile fine, but I don't have the hardware just yet to experiment with the actual boards and code myself on my easyPIC PRO v7.
Basic premise of my projects code is; If not physically plugged in with cable (Ethernet), Wifi takes over, all to make some pretty lights do some stuff. A user can change patterns or colours from a webserver (code held in MCU).

I see in the ETH Click code it probably uses MikroBUS-1.
From the example code where "_MIKROBUS1" is used;

Code: Select all

sub procedure applicationInit() 

    eth_spiDriverInit(T_ETH_P(@_MIKROBUS1_GPIO), T_ETH_P(@_MIKROBUS1_SPI)) 
    Delay_ms(100) 
    SPI_Ethernet_Init(myMacAddr, myIpAddr, _ETH_FULLDUPLEX) 
    Delay_ms(100) 

end sub
That's fine, I plan to keep the ETH Click board on MikroBUS-1 anyway.


But in the WiFi 9 Click board example code, it also uses the same bus;

Code: Select all

sub procedure systemInit() 
    mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_AN_PIN, _GPIO_OUTPUT) 
    mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_PWM_PIN, _GPIO_INPUT) 
    mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_INPUT) 
    mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT) 
    mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_CS_PIN, _GPIO_OUTPUT) 
    mikrobus_uartInit(_MIKROBUS1, @_WIFI9_UART_CFG[0]) 
    mikrobus_logInit(_MIKROBUS3, 115200) 
    mikrobus_logWrite("---- System Init ----", _LOG_LINE) 
    Delay_ms(100) 
end sub

sub procedure applicationInit() 
    wifi9_configTimer() 
    wifi9_uartDriverInit(T_WIFI9_P(@_MIKROBUS1_GPIO), T_WIFI9_P(@_MIKROBUS1_UART)) 


My Question(s):
Can I use WiFi 9 Click in MikroBUS 2?
Is it as simple as changing all "_MIKROBUS1" references in the code (.mbas) to "_MIKROBUS2" and redoing 'Edit search paths' and 'Rebuild all sources' to compile?


Sorry for the long rambling post, hope to have given you where I'm at, lol

Any thoughts by author of WiFi 9 Click, Katarina Perendic, would be cool too! :)

Thanks!

User avatar
jovana.medakovic
mikroElektronika team
Posts: 986
Joined: 18 Dec 2018 10:36

Re: Advice about swapping MikroBUS 1 and 2 needed pls.

#2 Post by jovana.medakovic » 28 Jul 2020 07:54

Hello,

Yes, you can use Wifi 9 click board on MIKROBUS 2 slot.
You only need to write MIRKOBUS2 instead of MIKROBUS1.

Also, you should be able to use both click boards together. The pinout of MIKROBUS 1 and MIKROBUS 2 slots are not the same.
You only cannot use:
mikrobus_logInit( _LOG_USBUART, 9600 );
in the ETH project, because _LOG_USBUART uses RC6 and RC7 pins for UART and these pins are used by WiFi 9 click board on MIKROBUS2 for communications.

Kind regards,
Jovana

chris11jed
Posts: 156
Joined: 15 Jun 2011 06:37

Re: Advice about swapping MikroBUS 1 and 2 needed pls.

#3 Post by chris11jed » 30 Jul 2020 09:33

Hello Jovana,

Please excuse me for not getting back sooner.
I'm really pleased you've been able to help me though.

Not using the log line-of-code in the ETH click example "systemInit()" routine is fine and understandable.
And it's great to know the two click-boards can 'play nice' together with a slight change too.

Thank you again for your time.
:D 8)

User avatar
jovana.medakovic
mikroElektronika team
Posts: 986
Joined: 18 Dec 2018 10:36

Re: Advice about swapping MikroBUS 1 and 2 needed pls.

#4 Post by jovana.medakovic » 30 Jul 2020 13:32

Hi,

You're welcome.
If you have additional questions, feel free to ask.

Kind regards,
Jovana

Post Reply

Return to “mikroBasic PRO for PIC General”