STM32F030K6T6 with Si4703 on STM32CubeIDE?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-11 8:49 AM
Hi everybody.
I 'm trying to make an Si4703 radio module work with an STM32F030K6T6 on STM32CubeIDE.
I have found an example which is made with Coocox, I think. At https://github.com/LonelyWolf/stm32/tree/master/Si4703 but does not it work with STM32CubeIDE.
So, is there some example that works with STM32CubeIDE?
- Labels:
-
STM32CubeIDE
-
STM32F0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-11 9:17 AM
It looks to use the old SPL for the F1 part.
Expect you'll have to do the porting, seems relatively niche.
The GNU/GCC compiler should be able to do this.
Migrating this into Keil, which has a licence for CM0(+) STM32 parts, should also be possible.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-11 9:27 AM
I 've made a project based on the above mentioned example but I face some issues, e.g.:
void Si4703_Read(void) {
uint8_t i;
uint8_t buffer[32]; // 16 of 16-bit registers
I2C_AcknowledgeConfig(I2C_PORT,ENABLE); // Enable I2C acknowledge
I2C_GenerateSTART(I2C_PORT,ENABLE); // Send START condition
while (!I2C_CheckEvent(I2C_PORT,I2C_EVENT_MASTER_MODE_SELECT)); // Wait for EV5
I2C_Send7bitAddress(I2C_PORT,Si4703_ADDR,I2C_Direction_Receiver); // Send slave address for READ
while (!I2C_CheckEvent(I2C_PORT,I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED)); // Wait for EV6
// Si4703 read start from r0Ah register
for (i = 0x14; ; i++) {
if (i == 0x20) i = 0x00;
while (!I2C_CheckEvent(I2C_PORT,I2C_EVENT_MASTER_BYTE_RECEIVED)); // Wait for EV7 (Byte received from slave)
buffer[i] = I2C_ReceiveData(I2C_PORT); // Receive byte
if (i == 0x12) break;
}
I2C_AcknowledgeConfig(I2C_PORT,DISABLE); // Disable I2C acknowledgment
I2C_GenerateSTOP(I2C_PORT,ENABLE); // Send STOP condition
while (!I2C_CheckEvent(I2C_PORT,I2C_EVENT_MASTER_BYTE_RECEIVED)); // Wait for EV7 (Byte received from slave)
buffer[i++] = I2C_ReceiveData(I2C_PORT); // Receive last byte
for (i = 0; i < 16; i++) {
Si4703_REGs[i] = (buffer[i<<1] << 8) | buffer[(i<<1)+1];
}
}
In line 'I2C_AcknowledgeConfig' : implicit declaration of function 'I2C_AcknowledgeConfig'.
The same at 'I2C_GenerateSTART'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-11 9:38 AM
STM32F1 SPL functions, you'd need to pull in an instance of that if not part of the project.
http://stm32.kosyak.info/doc/group___i2_c___exported___functions.html
If you're trying to build a HAL F0 project, would suggest constructing a simple shell or donor project for your IC / Board. Then start merging in chunks of the other project, making equivalent functions using the HAL's I2C and UART libraries.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-11 9:47 AM
I 'm trying to build a HAL F0 project.
Thanks, really complicated...I'm lost in the code.. :)
So what I hould do is convert SPL functions to HAL...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-11 10:49 AM
This (taken from here:(
/**
* @brief Enables or disables the specified I2C acknowledge feature.
* @param I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* @param NewState: new state of the I2C Acknowledgement.
* This parameter can be: ENABLE or DISABLE.
* @retval None.
*/
void I2C_AcknowledgeConfig(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the acknowledgement */
I2Cx->CR1 |= CR1_ACK_Set;
}
else
{
/* Disable the acknowledgement */
I2Cx->CR1 &= CR1_ACK_Reset;
}
}
...to HAL?
:o It'll take me a few lifetimes...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-11 11:08 AM
Well presumably you'll want to read the SiLab's data-sheet and understand what's actually needed, at a higher level ,and perhaps use the HAL's HAL_I2C_Mem_Read() and HAL_I2C_Mem_Write() to do register level transactions with a typical I2C methodology.
Register reading example for a uBlox device at I2C address 0x42, read 2 bytes from register 0xFD and 0xFE
uint8_t data[2];
HAL_StatusTypeDef status = HAL_I2C_Mem_Read(&I2CHandle, (0x42 << 1), 0xFD, 1, data, sizeof(data), 100);
If you understand the intent of what's needed you can probably significantly declutter the implementation you're using, and use high level constructs.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-22 3:49 AM
Hi @Panagiotis​ ,
SPL2LL-Converter may be helpful in such case. Look to the documentation for the How To use it.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
