Comments (4)
Hi rayaan92,
the repository contains drivers for the usart. You can also find board specific hardware drivers and setup examples.
from loramac-node.
thanks, I have had a look at it and have given it a try but I can't seem to get it up and running and I need it urgently. I am working on the SK-IM880 platform, and once I try and configure the uart the code just hangs. here's a snippet of the debug code that i have written.
void debugmcu( void)
{
UartInit( &Uart1, UART_1, UART_TX, UART_RX );
UartConfig( &Uart1, RX_ONLY, 115200, UART_8_BIT, UART_1_STOP_BIT, NO_PARITY, NO_FLOW_CTRL );
}
void debugInit ( void )
{
FifoInit( &Uart1.FifoTx, TxBuffer, FIFO_TX_SIZE );
}
void debug_char(uint8_t c)
{
UartMcuPutChar( &Uart1, c);
}
void debug_str(const uint8_t* str)
{
while(_str)
{
debug_char(_str++);
}
from loramac-node.
One of the issues that I see in your code example is that you configure the UART as RX_ONLY but you are trying to send data. So, you should change the debugmcu
function as follows
void debugmcu( void)
{
UartInit( &Uart1, UART_1, UART_TX, UART_RX );
UartConfig( &Uart1, TX_ONLY, 115200, UART_8_BIT, UART_1_STOP_BIT, NO_PARITY, NO_FLOW_CTRL );
}
Most of the UART functions return status values. Those return values should be checked in order to verify that the UART peripheral is not busy performing some other operation.
In your code you initialize the transmission FIFO but, to print debug messages most of the time there is no need to do it. Using a FIFO will consume some amount of RAM memory that may be necessary for your application.
Please note also that printing debug messages on interrupt handling functions is not recommended. Print functions are quite time consuming while an interrupt handling function must be handled as quick as possible.
Please find below a simple example to perform an UART echo. I didn't test the example nor compiled it but I guess that it is correct.
int8_t welcomeStr = "Echo application. Every typed char is echoed!!!\r\n";
int main ( void )
{
uint8_t data = 0;
UartInit( &Uart1, UART_1, UART_TX, UART_RX );
UartConfig( &Uart1, RX_TX, 115200, UART_8_BIT, UART_1_STOP_BIT, NO_PARITY, NO_FLOW_CTRL );
// Print welcome message
while( UartPutBuffer( &Uart1, welcomeStr, strlen( welcomeStr ) ) != 0 ){ };
while( 1 )
{
if( UartGetChar( &Uart1, &data ) == 0 )
{
while( UartPutChar( &Uart1, data) != 0 ){ };
}
}
}
from loramac-node.
Hi Miguel,
I built the snippet code you gave me and it does npt want to build, however
i am using it as a guideline, I am currently working on the sk-im880a class
A LoRamac from you, however when I try to the uart interface the board goes
into a weird state and it seems like it just halts at that point. belong is
the snippet of my code, I do the initialization in the BoardInitMcu
function.
void BoardInitMcu( void )
{
if( McuInitialized == false )
{
// We use IRQ priority group 4 for the entire project
// When setting the IRQ, only the preemption priority is used
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
// Disable Systick
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk; // Systick IRQ off
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk; // Clear SysTick
Exception pending flag
AdcInit( &Adc, POTI );
UartInit( &Uart1, UART_1, UART_TX, UART_RX);
UartConfig(&Uart1, RX_TX, 115200, UART_8_BIT, UART_1_STOP_BIT,
NO_PARITY, NO_FLOW_CTRL); (once I comment this line of code out the rest of
the code executes)
SpiInit( &SX1272.Spi, RADIO_MOSI, RADIO_MISO, RADIO_SCLK, NC );
SX1272IoInit( );
#if( LOW_POWER_MODE_ENABLE )
TimerSetLowPowerEnable( true );
On Fri, Mar 11, 2016 at 4:59 PM, Miguel Luis [email protected]
wrote:
—
Reply to this email directly or view it on GitHub
#40 (comment).
from loramac-node.
Related Issues (20)
- Is getting 0x00 upon calling GetStatus API?
- Integer underflow while calculating RXWindow
- TxPower in ADR Backoff sequence HOT 1
- Long range at sea : 10-20 km expected, 300m obtained !! HOT 2
- Add an option to build using platformio
- NVM Restore issue HOT 6
- KR920 LBT test faillure
- Default Data Rate for channels in CFList in region EU868 HOT 1
- Class C: Sending ConfirmedDataDown does not result in ACK HOT 1
- Missing critical section in SX1272WriteBuffer and SX1272ReadBuffer
- Devnonce is starting at 1 instead of 0 HOT 1
- how to use this library in keil software and send uplink and perform downlink ?
- LORAMAC_STATUS_SKIPPED_APP_DATA never pushed to application layer
- how to understand the transmission time on air? HOT 1
- mpl3115.c uses `double`
- AdrAckCounter not incremented on "wrong" downlink frame received HOT 1
- ACK not received in class C HOT 1
- FRMPayload < 10 bytes not de-encrypted on AWS HOT 1
- EEPROM emulation library problems with STM32L4xx single-bank flash configuration HOT 3
- Determining ADR & Gateway Status HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loramac-node.