lonelywolf / stm32 Goto Github PK
View Code? Open in Web Editor NEWSTM32 stuff
License: The Unlicense
STM32 stuff
License: The Unlicense
Hi there
i am using a stm32 and bmp180, and i already replace the old cmsis, but there are still many errors in the code, actually there are many undefined varablse in the startup.c. it might be some problem about the direction i have setted. but it a bit hard for me to find to debug.
Could you please share the workspace with bmp180? thank you so much.
Best wishes.
Linyu Cai
Здравствуйте Дмитрий, видел ваш коммент здесь(http://forum.easyelectronics.ru/viewtopic.php?f=35&t=29003) насчет перевода sd card в high-speed mode в stm32. Формирую cmd52 по всячески, но получаю тайм-аут постоянно. Подскажите если делали, пожалуйста.
Line 101 in a6c1049
The problem: you have two boards and two nrf24l01 radios and you're trying to make them communicate.
And nothing seems to work. You check your code, wiring, experiment with changes here and there but no luck - no communication. Radios are set up to transmit and receive but nothing happens.
Now you have no idea what is wrong - is it the transmitter side or receiver side? Are the radios working at all? Maybe one is broken, but which one? Or is it software? Or wiring?
Basically you have no idea where the problem may be. Or it worked yesterday but today doesnt work and you have no idea why. You try to find a problem but where to start? There's no indication which radio works and which doesnt, software doesnt report any problems, so without any specialized equippment you can only guess.
So my suggestion is to add some diagnostic function to the library - check if we're talking to the hardware at all, check if it responds in expected way, if there are some transmission attempts, even unsuccessful - report it - some sanity check protocol - and try to extract as much information as possible.
At the moment the nrf24l01 library writes the address in reverse order compared to the Arduino library which makes it incompatible unless you specify the address in reverse order.
void nRF24_SetAddr(uint8_t pipe, const uint8_t *addr) {
uint8_t addr_width;
// RX_ADDR_Px register
switch (pipe) {
case nRF24_PIPETX:
case nRF24_PIPE0:
case nRF24_PIPE1:
// Get address width
addr_width = nRF24_ReadReg(nRF24_REG_SETUP_AW) + 1;
// Write address in reverse order (LSByte first)
addr += addr_width;
nRF24_CSN_L();
nRF24_LL_RW(nRF24_CMD_W_REGISTER | nRF24_ADDR_REGS[pipe]);
do {
nRF24_LL_RW(*addr--);
} while (addr_width--);
nRF24_CSN_H();
break;
case nRF24_PIPE2:
case nRF24_PIPE3:
case nRF24_PIPE4:
case nRF24_PIPE5:
// Write address LSBbyte (only first byte from the addr buffer)
nRF24_WriteReg(nRF24_ADDR_REGS[pipe], *addr);
break;
default:
// Incorrect pipe number -> do nothing
break;
}
}
is how it is currently done which makes it incompatible with nrf24 modules connected up to an Arduino.
void nRF24_SetAddr(uint8_t pipe, const uint8_t *addr) {
uint8_t addr_width;
// RX_ADDR_Px register
switch (pipe) {
case nRF24_PIPETX:
case nRF24_PIPE0:
case nRF24_PIPE1:
// Get address width
addr_width = nRF24_ReadReg(nRF24_REG_SETUP_AW) + 1;
nRF24_CSN_L();
nRF24_LL_RW(nRF24_CMD_W_REGISTER | nRF24_ADDR_REGS[pipe]);
//Write the address
for(int x = 0; x < addr_width; x++){
nRF24_LL_RW(*addr++);
}
nRF24_CSN_H();
break;
case nRF24_PIPE2:
case nRF24_PIPE3:
case nRF24_PIPE4:
case nRF24_PIPE5:
// Write address LSBbyte (only first byte from the addr buffer)
nRF24_WriteReg(nRF24_ADDR_REGS[pipe], *addr);
break;
default:
// Incorrect pipe number -> do nothing
break;
}
}
fixes it, I haven't tried it with pipes 2->5 though.
Hey lonelywolf,
I'm making some STM32F030 examples where i used your code.
Because you are using the STM32F1, and i am using the STM32F0 the code is very different.
But i'm using the BMP180 registers and stuff. I know that's not your invention, because it's actually from bosch.
I just want to give you credit for your work, and i just don't know how to do it.
What can you agree upon as reference in my BMP180 code ?
Greetings,
Robbe
Hello Dmitry,
I downloaded and modified your nRF24 library. A summary of changes is below and the code is attached. I would like to know your original license, as it is not specified in the project.
If possible, I want to release it together my modifications using some BSD like license.
My modifications in the original code base are:
nrf24.c/.h
nrf24_hal.c/.h
I created a nrf24_app.h/.c where user can choose between two communication scenarios:
Users can choose between scenarios and set if they want to be PTX or PRX. Callbacks are provided for tx and rx operations (see main.c). It is easy to use.
In function nRF24_ReadPayload:
*length = nRF24_ReadReg(nRF24_REG_RX_PW_P0 + pipe);
It works only for fixed size payload.
I suggest replacing with:
*length = nRF24_ReadReg(CMD_R_RX_PL_WID);
This will work for both fixed size and dynamic.
When ls027b7dh01 was tested with an LS044Q7DH01 display, the display was blank, It worked when the SPI baud rate was reduced from 16MHz (2MHz fSCLK) to 1.6MHz (1MHz fSCLK). The typical fSCLK frequency is 1MHz and maximum is 2MHz from the LS044Q7DH01 datasheet.
Also the SPI configuration in main.c is hardcoded to use SPI2, rather than use the configuration from the header file.
#if (SPI1_USE)
SPI1_HandleInit();
#endif
#if (SPI2_USE)
SPI2_HandleInit();
#endif
#if (SPI3_USE)
SPI3_HandleInit();
#endif
SPI_Init(&SMLCD_SPI_PORT, SPI_CLK_PL_E1, SPI_DIR_TX);
SPI_SetDataWidth(&SMLCD_SPI_PORT, SPI_DW_8BIT);
SPI_SetRXFIFOThreshold(&SMLCD_SPI_PORT, SPI_RXFIFO_THQ);
//SPI_SetBaudrate(&hSPI2, Clock_SPICalcDivider(&hSPI2, 16000000));
SPI_SetBaudrate(&SMLCD_SPI_PORT, Clock_SPICalcDivider(&hSPI2, 16000000/10));
SPI_Enable(&SMLCD_SPI_PORT);
Delay_Init does not defined in delay.c and also it need to define this constants and variables
#define DELAY_TICK_FREQUENCY_US 1000000 /* = 1MHZ -> microseconds delay /
#define DELAY_TICK_FREQUENCY_MS 1000 / = 1kHZ -> milliseconds delay */
static __IO uint32_t TimingDelay; // __IO -- volatile
Arduino is used to program stm32 processors, but in the available library it is not possible to choose the type of spi port to connect nrf24l01
Line 98 in a6c1049
Please, for compatibility with different stm32 microcontrollers, replace this check with the following:
while (I2C_CheckEvent(I2C_PORT,I2C_EVENT_MASTER_MODE_SELECT)==ERROR);
For stm32f4 ErrorStatus
defined as:
typedef enum
{
ERROR = 0U,
SUCCESS = !ERROR
} ErrorStatus;
Please do this in all your code
I'm trying to run the usb-mic project on a Nucleo-L4R5Zi board. I created an empty project for this board in STM32CubeIDE and drag/dropped the files into the project. It builds OK but I hit a hard fault in system init on the line:
RCC->CR |= (uint32_t)0x00000100;
I suspect the problem is with how I'm building it. Are there instructions on building this, or an updated project for the STM32CubeIDE?
Any guidance is greatly appreciated.
hello and thank you for these great libraries
how can I send data by nrf24l01 in this library ?
I use this code but always gives me UnSuccess & UnSuccess nRF24_MASK_MAX_RT
nRF24_TXMode();
Delay_ms(10);
status = nRF24_TXPacket(txBuf,TX_PAYLOAD);
if (status & nRF24_MASK_TX_DS)
{
UART_SendStr("---SEND-->>> Success\n");
} else if (status & nRF24_MASK_MAX_RT)
{
UART_SendStr("---SEND-->>> UnSuccess nRF24_MASK_MAX_RT\n");
} else
{
UART_SendStr("---SEND-->>> UnSuccess \n");
}
Hello,
wonderful code, well done.
There should be a small correction at The function "to Human readable Format"
hrf_date->Hours = raw_date->hours;
and
hrf_date->Year = raw_date->year + 2000;
otherwise both are in hexadecimal :)
So my 2016 was 2010 with your code.
Maybe I messed up...but check yourself again because we are in the hex overflow year 16 :D
How to use dma.h in Arduino using stm32f103c8t6 plz provide some examples thnx in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.