Well, this should be asked into IoT and maybe they'll tell you to ask into Electronics. With rpis being catch-all wizards I guess I'll drop you a line anyway.
Does mac tx and radio tx commands are used for same purpose?
Absolutely not. It's better to start from the raw radio tx.
Look at the example:
radio tx 48656c6C6F
// Transmits a packet of [0x48][0x65][0x6c][0x6C][0x6F]; Hello.
You can also read a bit below:
The mac pause
command must be called before any radio transmission or reception, even if no MAC operations have been initiated before.
And right at payload description:
data: hexadecimal value representing the data to be transmitted, from 0 to 255 bytes for LoRa modulation and from 0 to 64 bytes for FSK modulation.
Note there are a few low-level details here. If you go to page 44 you can read the description of the various commands:
tx This command configures a simple radio packet transmission according to prior configuration settings
Then go to page 12 and see figure 1-2 showing the relationships between MAC and Radio commands. Radio commands are also referred as 'transceiver' commands.
Let's go back to mac tx
. As you can see at page 22 this has knowledge of some LoRaWAN notions such as type
and portno
.
What this latter function will do is to wrap your data in a valid LoRaWAN compatible envelope (bigger) and send the result to radio tx
. In other words, radio tx
is the low-level packetized raw send allowing use of the radio as a pure 'emitter', perhaps with LoRa modulation but without the WAN part. This is very convenient to build your own protocol.
Why messages are not transmitting to TTN? Do I need to have a gateway here?
Certainly. In theory the raspberry is fairly well set up to be the gateway itself and then you need someone to send data to you.
You are omitting too many details to make any reasonable guess but I would encourage in using the raw radio first and build in small steps.
Example: "here"... where?