8 years, 10 months ago.

Pin Connections

Hi,

I am new to microcontrollers. I have gone through the pingpong code and saw there are no pin numbers mentioned in the program for establish communication between microcontroller and transmitter. If there is any connections for the microcontroller to transmitter can some one help me with this.

I am using NUCLEO-L152RE platform.

Also for my project I am using a barebone from Modtronix which is developed on basing on the schematics of SX1276, but looks completely different. So after going through some websites i came to know that MISO, MOSI, SCK pins can be used to connect both the transmitter and microcontroller but i don't see those pins except for the arduino connectors. Can i use them to connect the transmitter and my question is should i define them in the program or are they automatically allocated my the microcontroller.

http://modtronix.com/inair9B.html

Requesting few suggestions.

Question relating to:

1 Answer

8 years, 10 months ago.

Yes you can connect to the transmitter. They are automatically allocated for the pin names based on the dev-board you are using. https://developer.mbed.org/platforms/ST-Nucleo-L152RE/

Assuming that you are using the dev-platform, it looks as if the LoRa module should directly socket into the platform. Looking at the LoRa help page: SCK is D13, MOSI is D11, MISO is D12 The "MBED" pins are automatically defined in the mbed library to match the platforms. So, if you use the pins labeled on the NUCLEO board with blue/white or green/white they should match up with the pins visually listed on the platform board. So, for your case, you would define the SPI1 bus (D13,D12,D11) as the pins for communication between your dev-board and the LoRa module.

Accepted Answer

Thankyou very much Elijah.

So defining those at the beginning of the program once is enough right and the microcontroller automatically does the rest every time. Cant i like use the pins of the arduino since they are already defined in the sx1276.cpp and the library is build basing on that. what i was speaking is on line 46 of the below provided link.

https://developer.mbed.org/compiler/#nav:/SX1276PingPong/SX1276Lib/sx1276/sx1276.cpp;

Regards

posted by Nandan Sadineni 08 Jun 2015

Nandan,

Not sure what they are doing in the main.cpp file with calling the Radio() constructor with type defined as SX1276MB1xAS [at line 67], but I would think they are creating a Radio object defined using the callback function pointers passed to Radio and returning an object of type SX1276MB1xAS from the constructor as the "Radio".

So, based on what their code is doing, no. You don't have to use the pins since they are already being declared in the sx1276.cpp file. All you have to do to initialize your radio is to pass the callback functions you want the radio to call on events to the Radio() constructor in the main.cpp file at line 67.

Example: Here's what my main.cpp code might have: SX1276MB1xAS Radio( OnTxDone, OnTxTimeout, OnRxDone, OnRxTimeout, OnRxError, OnFhssChangeChannel, NULL ); Bunch of main code here...... Function declarations for the callback functions passed to Radio: void OnTxDone( void ){} void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr){} void OnTxTimeout( void ){} void OnRxTimeout( void ){} void OnRxError( void ){} void OnFhssChangeChannel( uint8_t channelIndex ){}

posted by Elijah P 08 Jun 2015

The digital pins shown on the LoRa module as DIO0,DIO1, etc. are all in use by the module for transmission, and should not be used (afaik). The pins defined in line 46 of https://developer.mbed.org/compiler/#nav:/SX1276PingPong/SX1276Lib/sx1276/sx1276.cpp are used internally for the libraries. Are you asking about using just the pingpong program as it is defined? Or using the unused pins on the LoRa module? Or just using the arduino pins for the NUCLEO-L152RE board? You shouldn't need to define the arduino pins, as they are already defined. You can call them as D12, D11, etc. to use them, but trying to define them would not work. The line 46 you referred to is used internally in the library to interface the LoRa module to the MBED arduino socket, with the pins predefined by the library itself, only requiring the user to write the callback functions and the main.cpp file.

posted by Elijah P 08 Jun 2015

Elijah Thankyou again,

I was speaking about the arduino pins only. The main doubt i have is are those pins defined for transmitter or the nucleo board. But as you were also telling that they are defined for the nucleo board itself I am confident enough. So can i directly connect them to the transmitter's MISO, MOSI ports?

Just for reference did you work on this inair9B module before?

Regards

posted by Nandan Sadineni 09 Jun 2015

Nope, havn't worked with that module. Yes, I would assume you just plug the MOSI on your board to the MOSI arduino pin, the MISO on your board to the MISO arduino pin, etc.

The NUCLEO board socket is designed to be arduino (compatible/similar) to allow easy development.

The program code defines the pins for the processor on the board to use when running all of the software. The software is assuming you have the same (MOSI,MISO,SCK,etc.) connection between the two hardware boards, so as long as your inair9B module is operating as the module that the code was written as an example for, it should be plug-n-play.

posted by Elijah P 09 Jun 2015

Just a quick question. NUCLEO board is a master and LoRa module is a slave? Can I connect 3rd device as a slave to NUCLEO?

posted by Tomas Ausvicas 15 Apr 2016