STM32F334R8: ADC with DMA - stm32

Could someone provide me a basic code that just implements ADC with DMA for STM32 please ? I'd like to compare it to my solution that doesn't work.
Thank you.

How about this tutorial?
http://www.bepat.de/2020/11/27/stm32f103c8-adc-dual-regular-simultaneous-mode/
It describes how to use both ADCs of an F103C8 simultaneously with DMA.

Related

Watchpoint on STM32 GPIO register

using Keil µVision on a STM32F4 I am trying to add a watchpoint to a GPIO data register, which just does not trigger.
I want the watchpoint to be triggered as soon as output data gets writting into this register.
Setting the watchpoint to the os timer work fine.
Peripheral registers are memory mapped in STM32 F4, as far as I know.
Any (simple) explanation that I am missing here?
Any hint is very much appreciated.
While the ARM core can access the peripheral I/O registers in the same flat 32-bit address space as SRAM or flash, peripheral I/O registers are located in separate buses on the MCU, and not accessed by the same bus as the SRAM. For example, on the STM32F, there are the ABH bus which are usually further divided into the APB1 and APB2 buses, depending on the device. In any case, the debug controller unit defined by ARM ("CoreSight"), provides data watchpoint capability, and it only works on "real" data access.
Would be great if it did though ;-)
No source, or personal experience, but I can think of a few reasons why this wouldn't work.
Often value isn't "there" like in RAM, but is created when you access a peripheral register.
You could say periodic access could then solve this, but that wouldn't work for registers where reading has side effects (usually clearing some status flag).
I think you'll have to create an interrupt handler for GPIO, and a breakpoint for that.
there is a workaround if 12 cycles latency is a problem. Use Pin as a trigger which triggers memory to memory DMA transfer. Set the watchpoint on the destination (or source) RAM address.

Is there a CAN bus library for STM32 to direct connect with a CAN transceiver?

Many STM32 chipsets support 1 or 2 channel CAN PIN Outs.
Is there a CAN bus library for STM32 to direct connect with a CAN transceiver such as MCP2551? But it does not matter what the CAN transceiver is.
A CAN transceiver is just a high speed step down converter. (on a basic level)
CAN protocol works in a variant of voltage ranges. MCP2551 is a set CAN transceiver suitable for 12V and 24V systems. With added features to help with the physical layer like externally-controlled slope for reduced RFI emissions, detection of ground fault, voltage brown-out protection, etc.
It has no dependency on the CAN logic. It is just to help you with the bare physical layer.
To answer your question:
As RishabhHardas recommended, use the HAL library provided by STM32 through CubeMx.
Using CubeMx
This is a software provided by ST-Micro to help you setup the boilerplate code for any peripheral application.
You can also check out the examples projects provided by STM in the Cube. This will give you a kick-start in understanding CAN on STM32
STM32Cube_FW_F4_V1.9.0\Projects\STM324xG_EVAL\Examples\CAN\CAN_Networking
After setting it up, you'll be able to call HAL_CAN_Transmit() and HAL_CAN_Receive() by including the header.
Check out this discussion on STM32-Community.
For software, look for the CANtact open source project on Github. It is an implementation for the STM32F042. I had to adapt the project to build it under Atollic but it was not too hard and it works. It provides a SLCAN type of interface over a virtual COM port over USB, which is very fast and convenient.
There is also CAN code for the STM32F103 (Bluepill) (Google "lawicel-slcan") but that chip is not as convenient because you cannot use both CAN and USB at the same time (they share RAM buffers) so if you want CAN, you will not have USB, and routing the CAN messages over a UART will severely limit the bandwidth. That may be OK if your entire application runs on the STM32.

Is there any better option that PI4J to write/read from UART in raspbian?

i'm looking for a better way for UART I/O in my raspberryPI in the linux side where i'm using Java.
now i'm using PI4J (wiringPI) but i'm facing few problems, i noticed many missing messages.
Also it's limited to 57600 baud rate and i wish to use higher.
So i was wondering if there is another well tested way to communicate.
In the other side i run c on cc2530 which run perfectly.
My main problem is in the java side where some messages get lost.
Thanks
I'm not sure of the exact Zigbee module you're working with, but this summary of the CC2530 says that it supports UART and SPI. Perhaps you can check the documentation for the module you're using and see if SPI might be a better alternative. Depending on the 2530's capability, SPI can be much faster than 57600.
Ok Found the JSerialComm which give what i needed.

The DMA support is needed to implement a device type interrupt driven?

From what I understand, interrupt-driven I / O and DMA are two separate mechanisms, but I need to answer this question. I think the answer is no for the fact that it is not necessary
If a device uses DMA (Direct Memory Access), it is able to read or/and write directly from/to the main memory.
If a device can generate interrupts, it is able to notify the CPU that it requires attention.
So, DMA and interrupts are principally completely independent.
They can of course be combined, e.g. a device can notify the CPU that it has finished a DMA.
So, you are right, the answer is NO.

SH72867 with I2C

I am using ‘SH72867(Renesas)’ connect with ‘EEPROM(24LC04B)’ . In the customer’s document at ‘address 0xF0 of EEPROM have data 0x5555’, But when I reading from this address always return ‘0xFFFF’ and same with other address.
I can’t write to EEPROM too.
I used I2C sample of Renesas but not run.
Do you have any suggestion about setting up I2C?
Sorry for my bad English and no clear explanation.
Any help apprciated,
Thanks
Verify the common issues:
Data and clock are connected properly.
Pull up resistor on clock and data connected to VCC.
Loop the I2C read request, connect scope and verify that I2C signals are OK. In addition check the ACK bit.
Verify clock is lower then 400kHz.
When using code examples, they usually fit to specific board. Verify that the code example configuration is the same as your board.
Some MCU may have more then one I2C pinout options. The code example might use I2C module that connected to diffrent pins.