Update and answer The mistake i've made is keeping the Servo on PIN 34 ON while trying to test run the servo on CX-Drive. after making Servo ON pin OFF and the problem Solved.
I'm using CP1H-XA PLC and Omron G series Servo. I've connected the servo from CX-Drive and initialized the drive and auto-tuned with load connected with low rigidity settings.It was smooth until I've encoutered an error. CX-Drive showing me an error
Drive1:An error occured while preparing Test Run. (0x84). Please check: communications speed; Servo is ready; Servo is not used by others; and Parameters Torque limit input setting and Drive prohibited are not changed from their default values.
I've changed Torque limit and drive prohibited values to 2:Forward use Pn5e and Reverse use Pn5f
Pn5E and Pn5F values are 300 and 100 respectively.
Servo is in Ready condition and Pin 34 of CN1 is On.
Servo is not being used by any other process, i'm pretty sure of that 'cause servo is in ready and not giving servo busy input.
Communication speed(baud rate) is set to 9600 and I've tested it with 2400 bps to 57600 bps but no luck.
Can anyone know why it is giving such an error? Please let me know if have solution for that.
For PC Communication I've connected R88A-CCG002P2 Omron original cable and for PLC communication I've connected with same cable but used 9 pin D-type female to male connector. Servo Model is R88D-GT04H. and using RS232 Communication and on PLC connected with CP1W-CIF01.
Related
MCU : STM32L496
JFlash version: v6.32i
We are facing the "Connection to target under reset failed" issue, when we try to program the board with STM32 MCU.
We were programming the board before with no issues. This error started appearing suddenly and now we are not able to program the board. When we scoped the reset pin of the MCU, the reset pin is going low when we click the connect button in the JFlash and clearly the board is resetting (We can see the firmware functionality restarting).
We tried the following:
Tied the BOOT0 pin to VDD and tried booting to the system memory and then tried programming. But this doesn't made any difference.
Tried always pulling down the reset pin to GND while trying to flash.
We have ensured that there are no issues with the track leading to the JTAG interface of the MCU.
Could you please help to resolve this situation?
Is there any possibility that the firmware currently running in the MCU could prevent the flashing and lock the device?
STM32L4 has a feature called Read-out Protection (RDP). See section 1.1 of AN4758. If your firmware application sets (intentionally or accidentally) the RDP level to 1 or 2 in the "option bytes" memory area then the SWD/JTAG port is disabled from accessing flash memory (read, write, and erase).
If the RDP is level 0 or 1 then you should be able to read the option byte memory area. If RDP is level 1 then you should be able to set it back to level 0. The flash memory will be erased when setting RDP back to level 0 but the SWD/JTAG port will get re-enabled. If the RDP level is 2 then I believe there is no way to reset it.
This is a common problem with STM32 SWD interface. For successful programming you should not power your custom board/ other hardware with the ST link power, instead you should make the GND connection common and supply from external source. And if you are using ST link only for programming and not for debugging then you should use the STM32 bootloader(easier).
Hello to everyone I have a problem which is initializing the MAC and PHY(ksz8081mnx) on SAM4E16c. The main goal is to see if I can get information from the ethernet but unfortunately, I do not know how to read the data from the ethernet. I am new in this I hope someone can give me some tips to follow.
The tools that I am using are Atmel Studio IDE and Atmel ICE programming tool. The project I created is with Atmel Software Framework (ASF). I installed all drivers needed for the MAC and PHY (ksz8081mnx). I followed the "Quickstart guide for GMAC driver" which is on this website:
http://asf.atmel.com/docs/3.35.1/sam4e/html/gmac_quickstart.html
I uploaded the sketch and I tested it by looking at the router's client list if I can see the MAC address but I did not. I not sure if this is the right way of doing it but I had to try.
I not sure if I initialized the board as it should be. I took the board_init example from (sam4e16e xplained pro ASF).
These GMAC peripheral registers are in the SAM4E16C.H file and they are corresponding with the (ksz8081mnx) chip but there are not used anywhere.
Should I set them in the board_init somehow or should I leave it like it is shown in the first picture?
PIO definition for GMAC peripheral
These pictures are showing the Ethernet chip connection to the processor:
Schematics Ethernet
Schematics µC
Thank you, I am looking forward to your suggestions.
:)
1st of all read the all ENET gmac controller register, you are able to access these controller register or not.
ENET_BASE_ADDR - Base address of gmac controller.
ex val = readl(ENET_BASE_ADDR + offset);
Configure the registers which are responsible in ENET operation.
eg: Network control, network config register, PHY management register, Transmit status register, Receive status register,Tx Queue pointer, Rx Queue pointer.
Most important register where we need to configure the 6 byte MAC address.
#define ETHERNET_CONF_ETHADDR0 0x00
#define ETHERNET_CONF_ETHADDR1 0x04
#define ETHERNET_CONF_ETHADDR2 0x25
#define ETHERNET_CONF_ETHADDR3 0x1C
#define ETHERNET_CONF_ETHADDR4 0xA0
#define ETHERNET_CONF_ETHADDR5 0x026
After configure the MAC address into those register, then memory dumped those register to confirm that MAC address is properly configured or not.
prepare DMA tx and rx ring buffer descriptor. I will explain more in detail if you provide the complete gmac data sheet.
To access the PHY register, we need to configure the ENET GMAC phy management register properly.
Please provide the complete gmac and its PHY data sheet. I will answer more on phy and its operation.
I'm working on stm32f3 discovery board. For my current project I planned on coding a simple UART program on the board, I happened to read somewhere on the internet that to use the board for UART communication with PC the 'USER USB' has to be used.
My questions are the following
Firstly when i connect my board to PC using the 'USER USB'. The PC refuses to recognize the board.(F.Y.I- OS used is windows 7 64bit). This problem persists even after I update the driver! How to resolve this?
Is the "Connecting USER USB" part correct? because I can't see any RS232 chip on board
Should I use an add on board?
P.S I've installed all the necessary drivers from ST website and works flawlessly while using 'ST-Link interface' part of the board
I started working with the STM32F3 disco a few weeks ago. The user USB thing is a bit tricky.
To get it clear: The board has 2 USB ports.
One mostly for programming and debugging. It connected to a second ST chip which works as programming adapter.
The seconds (called USER USB) is connected to the STM32F303 chips you program
So what you can do is to configure your STM32 to implement a CDC over USB. With the windows driver installed (automatic or from ST, depends on OS version) you should get a virtual com port in your device manager. If you don't have the driver, you also get a device labeled as virtual com port but with a yellow exclamation mark.
So if I get you question right, this is what you're trying to do? Then yes, "Connecting USER USB" is correct. No, you don't need an extension board.
How to resolve that? It depends:
Do you already see the device in your device manager as communication device or serial interface or something? Then only the CDC driver from ST is missing.
Or do you get an "Unknown Device" in your device manager? That is what I experienced.
In STM32CubeMX you need to enable the USB device (Peripehrals->USB)
In STM32CubeMX you need to select the USB stack (MiddleWares->USB_DEVICE->Communication Device Class)
Generate the code. If you are using HSI as clock source CubeMX will generate a error message you can ignore for now. For a real product you should use an external clock.
Note that there is a bug in CubeMX version 4.20. The code generator generates code which may not work if you select HSE as clock input source. Even if you go back to HSI, the error remains.
Compile an run the code. You maybe need to reset the board removing BOTH USB plugs
Windows should detect the board now.
Extra problem: The board is ... well. Tricky. If you only plug in the USER USB to your PC, it should work but Windows may also inform you that you have an UNKNOWN DEVICE because enumeration has failed.
Remove the plug again. Now, first plug in the other, ST-LINK USB to power on the board. Wait 1-2 seconds. Now plug in the USER USB. There seems to be a startup problem. Only using the USER USB for power supply and CDC seems to run in a race condition between boot and USB and USB enumeration fails. First powering the board and then plugging in removes this race condition (at least at my board)
Now Windows should enumerate the device and offer you a virtual com port. Actually you should get two of them: One "ST... STLink Virtual COM Port" and one "ST... Virtual COM Port". The seconds one is the one you are looking for.
I hope that was the answer on the question you had.
Thanks for the post, had the same issue, here is what I added
Approach: Turn-off USB lines programmatically by changing input to output, forcing it to zero and reenable them after around 1 second
Also used power-off and on from ST USB Libs
// Force Re-Enumeration by the USB Host
//
int aux_retrigger_usb()
{
GPIO_InitTypeDef GPIO_InitStructure;
// ST USB Function
PowerOff();
// Program Pin 12 USB_DP from Input to Output
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);
// Set USB_DP to 0
GPIOA->BRR |= GPIO_Pin_12 ;
// Wait for for minimum 32* 50msec , 1,6 secs
while(tim3_cnt%32!=0) ; while(tim3_cnt%32!=31) ;
// ST USB Functions
PowerOn();
USB_Init();
Virtual_Com_Port_Reset() ;
// Program Pin 12 USB_DP from Output to input
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);
return 1 ;
}
So basically to avoid the power on race condition, the ports may be programmed
first to outputs and then released after 1 second.
I'm also struggling with the STM32F302. The USB is not recognized by the HUB Down stream port, and therefore does not appear in a device manager on PC(HUB's upstream port is connected to PC).
So, I made a deep search after I checked all the HW and SW.
It appears that 1.5Kohm resistor should be added on a DP, as F302 does not have the embedded one.
My design does not have neither, so hopefully, it will solve the issue tomorrow, so I have a hope for tonight)
You can read AN4879 by ST - the place I found these directions.
I have a Raspberry Pi2 running Windows 10. I want to control a servo using PWM (porting some netduino code). There does not appear to be a PWM pin at all on the Pi-> with the possible exception of 12 (GPIO 18). Can someone confirm this?
Thanks
Hardware PWM and ADC are not supported right now on RPi2 (Windows IoT). You need some extra circuitry which can generate PWM or record ADC on demand. There some project works available for that.
How you can achieve PWM & ADC on RPi2 + Windows IoT?
RPi2 will be connected to a gateway device via I2C/SPI Bus. A gateway device is nothing more than a microcontroller like Arduino. We need to program gateway to respond RPi2. Gateway device will act as I2C/SPI slave. Whenever RPi2 requests to write specific PWM pin, Gateway will generate PWM for that pin on demand.
Something you might like:
PWM Servo Control (RPi2 + Windows IoT):
https://www.hackster.io/AnuragVasanwala/windows-10-iot-core-ultrasonic-distance-mapper-d94d63
PWM Motor Speed Control & Retrieve ADC (RPi2 + Windows IoT):
https://www.hackster.io/AnuragVasanwala/windows-10-iot-core-hydroflyer-f83190
Yes and I doubt it will ever be added to Windows. Windows isn't a "Real Time" OS so it can't make the precise microsecond pulses required for PWM hardware.
Apparently there are breakout boards that could do this (ex: https://www.adafruit.com/products/815)
I haven't tried any yet though.
I have an old hub that sucks, so I converted it to a USB-tripler by soldering all of the input 4 wires to the corresponding wires on the output connectors. I had to do this because modern devices require 2.0 or 2.8 volts on d+, and refuse to charge if d+ is shortened or not connected. It works well charging three devices from a 1a wall adapter.
But if someone accidentally connects this to a PC port, what will happen? Well if there is only one device, it would be detected no problem. But if two devices are wired to the same port, how dangerous is that?
I would prefer the first connected device to be identified in the system, while the second connected devices just get the power.
One of the first steps in USB enumeration is to send a reset signal by driving D+ and D- low. All the devices plugged in will see the reset and think it was intended for them. After the reset they will each think they have address 0 and respond to requests to that address. The result will be multiple devices trying to drive the bus at the same time, for a brief period before the host gives up.
I think it wouldn't damage anything, but you will be causing a short circuit for a few microseconds which is bad.