Giter Site home page Giter Site logo

Tx-Cw app example about loramac-node HOT 4 CLOSED

lora-net avatar lora-net commented on August 25, 2024
Tx-Cw app example

from loramac-node.

Comments (4)

mluis1 avatar mluis1 commented on August 25, 2024

These registers description aren't disclosed by Semtech. Some of them are test registers which may damage the chip if their values are changed.

The current example sets the radio to always output 20 dBm regardless of the TX_OUTPUT_POWER value.

If you would like to test at another output power you may set the chip in FSK mode which is easier to setup in continuous wave mode and the results will be equivalent.

To do so you must set the radio in transmission mode using the FSK modem with a frequency deviation of 0 KHz.

Please find below an example: (I didn't test it but I think it should work)

#include <string.h>
#include "board.h"
#include "radio.h"

#define RF_FREQUENCY                                868000000 // Hz
#define TX_OUTPUT_POWER                             14        // 14 dBm

#define FSK_FDEV                                    0         // Hz
#define FSK_DATARATE                                50e3      // bps
#define FSK_BANDWIDTH                               50e3      // Hz
#define FSK_AFC_BANDWIDTH                           83.333e3  // Hz
#define FSK_PREAMBLE_LENGTH                         5         // Same for Tx and Rx
#define FSK_FIX_LENGTH_PAYLOAD_ON                   true

int main( void )
{
    // Target board initialisation
    BoardInitMcu( );
    BoardInitPeriph( );

    // Radio initialization
    Radio.Init( NULL );

    Radio.SetChannel( RF_FREQUENCY );

    Radio.SetTxConfig( MODEM_FSK, TX_OUTPUT_POWER, FSK_FDEV, 0,
                                  FSK_DATARATE, 0,
                                  FSK_PREAMBLE_LENGTH, FSK_FIX_LENGTH_PAYLOAD_ON,
                                  true, 0, 0, 0, 3000000 );

    TimerInit( &Led4Timer, OnLed4TimerEvent ); 
    TimerSetValue( &Led4Timer, 90000 );

    TimerInit( &Led2Timer, OnLed2TimerEvent ); 
    TimerSetValue( &Led2Timer, 90000 );

    TimerInit( &Led3Timer, OnLed3TimerEvent ); 
    TimerSetValue( &Led3Timer, 90000 );

    // Switch LED 1 ON
    GpioWrite( &Led4, 0 );
    TimerStart( &Led4Timer );

    // Sets the radio in Tx mode
    Radio.Send( NULL, 0 );

    // Blink LEDs just to show some activity
    while( 1 )
    {
        if( Led4TimerEvent == true )
        {
            Led4TimerEvent = false;

            // Switch LED 4 OFF
            GpioWrite( &Led4, 4 );
            // Switch LED 2 ON
            GpioWrite( &Led2, 0 );
            TimerStart( &Led2Timer );
        }

        if( Led2TimerEvent == true )
        {
            Led2TimerEvent = false;

            // Switch LED 2 OFF
            GpioWrite( &Led2, 1 );
            // Switch LED 3 ON
            GpioWrite( &Led3, 0 );
            TimerStart( &Led3Timer );
        }

        if( Led3TimerEvent == true )
        {
            Led3TimerEvent = false;

            // Switch LED 3 OFF
            GpioWrite( &Led3, 1 );
            // Switch LED 1 ON
            GpioWrite( &Led4, 0 );
            TimerStart( &Led4Timer );
        }    
    }
}

from loramac-node.

dbanello avatar dbanello commented on August 25, 2024

Thank you very much. It works perfectly.
I don't know if here is the right place but I have another question:
Is a way to configure SX1272 in order to transmit a PN9 sequence?
Br

from loramac-node.

mluis1 avatar mluis1 commented on August 25, 2024

The best place to ask this kind of questions is to ask them on the LoRa Community Semtech portal.

The SX1272 and SX1276 have no hardware PN9 sequence generator.
The drivers furnished in this repository don't enable the sending of PN9 sequence.

There would be a possibility which consists on using the Radio "Continuous Mode" chapter 4.2.13 of SX1272 datasheet and let a microcontroller generate the PN9 sequence and stream it to the DIO2/DATA and DIO1/DCLK radio pins.

from loramac-node.

dbanello avatar dbanello commented on August 25, 2024

Ok. Thank you very much for your answers.
Br

from loramac-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.